mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
mm: code cleanup for MADV_FREE
Some comments for MADV_FREE is revised and added to help people understand the MADV_FREE code, especially the page flag, PG_swapbacked. This makes page_is_file_cache() isn't consistent with its comments. So the function is renamed to page_is_file_lru() to make them consistent again. All these are put in one patch as one logical change. Suggested-by: David Hildenbrand <david@redhat.com> Suggested-by: Johannes Weiner <hannes@cmpxchg.org> Suggested-by: David Rientjes <rientjes@google.com> Signed-off-by: "Huang, Ying" <ying.huang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@kernel.org> Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Minchan Kim <minchan@kernel.org> Cc: Hugh Dickins <hughd@google.com> Cc: Rik van Riel <riel@surriel.com> Link: http://lkml.kernel.org/r/20200317100342.2730705-1-ying.huang@intel.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
7a9547fd4e
commit
9de4f22a60
16
mm/swap.c
16
mm/swap.c
@@ -276,7 +276,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
|
||||
void *arg)
|
||||
{
|
||||
if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
|
||||
int file = page_is_file_cache(page);
|
||||
int file = page_is_file_lru(page);
|
||||
int lru = page_lru_base_type(page);
|
||||
|
||||
del_page_from_lru_list(page, lruvec, lru);
|
||||
@@ -394,7 +394,7 @@ void mark_page_accessed(struct page *page)
|
||||
else
|
||||
__lru_cache_activate_page(page);
|
||||
ClearPageReferenced(page);
|
||||
if (page_is_file_cache(page))
|
||||
if (page_is_file_lru(page))
|
||||
workingset_activation(page);
|
||||
}
|
||||
if (page_is_idle(page))
|
||||
@@ -515,7 +515,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
|
||||
return;
|
||||
|
||||
active = PageActive(page);
|
||||
file = page_is_file_cache(page);
|
||||
file = page_is_file_lru(page);
|
||||
lru = page_lru_base_type(page);
|
||||
|
||||
del_page_from_lru_list(page, lruvec, lru + active);
|
||||
@@ -548,7 +548,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec,
|
||||
void *arg)
|
||||
{
|
||||
if (PageLRU(page) && PageActive(page) && !PageUnevictable(page)) {
|
||||
int file = page_is_file_cache(page);
|
||||
int file = page_is_file_lru(page);
|
||||
int lru = page_lru_base_type(page);
|
||||
|
||||
del_page_from_lru_list(page, lruvec, lru + LRU_ACTIVE);
|
||||
@@ -573,9 +573,9 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec,
|
||||
ClearPageActive(page);
|
||||
ClearPageReferenced(page);
|
||||
/*
|
||||
* lazyfree pages are clean anonymous pages. They have
|
||||
* SwapBacked flag cleared to distinguish normal anonymous
|
||||
* pages
|
||||
* Lazyfree pages are clean anonymous pages. They have
|
||||
* PG_swapbacked flag cleared, to distinguish them from normal
|
||||
* anonymous pages
|
||||
*/
|
||||
ClearPageSwapBacked(page);
|
||||
add_page_to_lru_list(page, lruvec, LRU_INACTIVE_FILE);
|
||||
@@ -962,7 +962,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
|
||||
|
||||
if (page_evictable(page)) {
|
||||
lru = page_lru(page);
|
||||
update_page_reclaim_stat(lruvec, page_is_file_cache(page),
|
||||
update_page_reclaim_stat(lruvec, page_is_file_lru(page),
|
||||
PageActive(page));
|
||||
if (was_unevictable)
|
||||
count_vm_event(UNEVICTABLE_PGRESCUED);
|
||||
|
Reference in New Issue
Block a user