Skip to content

Commit eb39d61

Browse files
Hugh Dickinstorvalds
authored andcommitted
mm: replace init_page_accessed by __SetPageReferenced
Do we really need an exported alias for __SetPageReferenced()? Its callers better know what they're doing, in which case the page would not be already marked referenced. Kill init_page_accessed(), just __SetPageReferenced() inline. Signed-off-by: Hugh Dickins <hughd@google.com> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Michal Hocko <mhocko@suse.cz> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Prabhakar Lad <prabhakar.csengg@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c2ea218 commit eb39d61

4 files changed

Lines changed: 6 additions & 15 deletions

File tree

‎include/linux/swap.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ extern void lru_add_page_tail(struct page *page, struct page *page_tail,
311311
struct lruvec *lruvec, struct list_head *head);
312312
extern void activate_page(struct page *);
313313
extern void mark_page_accessed(struct page *);
314-
extern void init_page_accessed(struct page *page);
315314
extern void lru_add_drain(void);
316315
extern void lru_add_drain_cpu(int cpu);
317316
extern void lru_add_drain_all(void);

‎mm/filemap.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,9 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
10911091
if (WARN_ON_ONCE(!(fgp_flags & FGP_LOCK)))
10921092
fgp_flags |= FGP_LOCK;
10931093

1094-
/* Init accessed so avoit atomic mark_page_accessed later */
1094+
/* Init accessed so avoid atomic mark_page_accessed later */
10951095
if (fgp_flags & FGP_ACCESSED)
1096-
init_page_accessed(page);
1096+
__SetPageReferenced(page);
10971097

10981098
err = add_to_page_cache_lru(page, mapping, offset, radix_gfp_mask);
10991099
if (unlikely(err)) {

‎mm/shmem.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
11661166
__SetPageSwapBacked(page);
11671167
__set_page_locked(page);
11681168
if (sgp == SGP_WRITE)
1169-
init_page_accessed(page);
1169+
__SetPageReferenced(page);
11701170

11711171
error = mem_cgroup_charge_file(page, current->mm,
11721172
gfp & GFP_RECLAIM_MASK);

‎mm/swap.c‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ static void __lru_cache_activate_page(struct page *page)
589589
* inactive,unreferenced -> inactive,referenced
590590
* inactive,referenced -> active,unreferenced
591591
* active,unreferenced -> active,referenced
592+
*
593+
* When a newly allocated page is not yet visible, so safe for non-atomic ops,
594+
* __SetPageReferenced(page) may be substituted for mark_page_accessed(page).
592595
*/
593596
void mark_page_accessed(struct page *page)
594597
{
@@ -614,17 +617,6 @@ void mark_page_accessed(struct page *page)
614617
}
615618
EXPORT_SYMBOL(mark_page_accessed);
616619

617-
/*
618-
* Used to mark_page_accessed(page) that is not visible yet and when it is
619-
* still safe to use non-atomic ops
620-
*/
621-
void init_page_accessed(struct page *page)
622-
{
623-
if (!PageReferenced(page))
624-
__SetPageReferenced(page);
625-
}
626-
EXPORT_SYMBOL(init_page_accessed);
627-
628620
static void __lru_cache_add(struct page *page)
629621
{
630622
struct pagevec *pvec = &get_cpu_var(lru_add_pvec);

0 commit comments

Comments
 (0)