Commit 6058eaec authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds
Browse files

mm: fold and remove lru_cache_add_anon() and lru_cache_add_file()



They're the same function, and for the purpose of all callers they are
equivalent to lru_cache_add().

[akpm@linux-foundation.org: fix it for local_lock changes]
Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarRik van Riel <riel@surriel.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Link: http://lkml.kernel.org/r/20200520232525.798933-5-hannes@cmpxchg.org


Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c843966c
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -4162,7 +4162,7 @@ cifs_readv_complete(struct work_struct *work)
	for (i = 0; i < rdata->nr_pages; i++) {
		struct page *page = rdata->pages[i];

		lru_cache_add_file(page);
		lru_cache_add(page);

		if (rdata->result == 0 ||
		    (rdata->result == -EAGAIN && got_bytes)) {
@@ -4232,7 +4232,7 @@ readpages_fill_pages(struct TCP_Server_Info *server,
			 * fill them until the writes are flushed.
			 */
			zero_user(page, 0, PAGE_SIZE);
			lru_cache_add_file(page);
			lru_cache_add(page);
			flush_dcache_page(page);
			SetPageUptodate(page);
			unlock_page(page);
@@ -4242,7 +4242,7 @@ readpages_fill_pages(struct TCP_Server_Info *server,
			continue;
		} else {
			/* no need to hold page hostage */
			lru_cache_add_file(page);
			lru_cache_add(page);
			unlock_page(page);
			put_page(page);
			rdata->pages[i] = NULL;
@@ -4437,7 +4437,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
			/* best to give up if we're out of mem */
			list_for_each_entry_safe(page, tpage, &tmplist, lru) {
				list_del(&page->lru);
				lru_cache_add_file(page);
				lru_cache_add(page);
				unlock_page(page);
				put_page(page);
			}
@@ -4475,7 +4475,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
			add_credits_and_wake_if(server, &rdata->credits, 0);
			for (i = 0; i < rdata->nr_pages; i++) {
				page = rdata->pages[i];
				lru_cache_add_file(page);
				lru_cache_add(page);
				unlock_page(page);
				put_page(page);
			}
+1 −1
Original line number Diff line number Diff line
@@ -840,7 +840,7 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
	get_page(newpage);

	if (!(buf->flags & PIPE_BUF_FLAG_LRU))
		lru_cache_add_file(newpage);
		lru_cache_add(newpage);

	err = 0;
	spin_lock(&cs->req->waitq.lock);
+0 −2
Original line number Diff line number Diff line
@@ -335,8 +335,6 @@ extern unsigned long nr_free_pagecache_pages(void);

/* linux/mm/swap.c */
extern void lru_cache_add(struct page *);
extern void lru_cache_add_anon(struct page *page);
extern void lru_cache_add_file(struct page *page);
extern void lru_add_page_tail(struct page *page, struct page *page_tail,
			 struct lruvec *lruvec, struct list_head *head);
extern void activate_page(struct page *);
+2 −6
Original line number Diff line number Diff line
@@ -1879,13 +1879,9 @@ xa_unlocked:

		SetPageUptodate(new_page);
		page_ref_add(new_page, HPAGE_PMD_NR - 1);

		if (is_shmem) {
		if (is_shmem)
			set_page_dirty(new_page);
			lru_cache_add_anon(new_page);
		} else {
			lru_cache_add_file(new_page);
		}
		lru_cache_add(new_page);

		/*
		 * Remove pte page tables, so we can re-fault the page as huge.
+1 −1
Original line number Diff line number Diff line
@@ -3139,7 +3139,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
				if (err)
					goto out_page;

				lru_cache_add_anon(page);
				lru_cache_add(page);
				swap_readpage(page, true);
			}
		} else {
Loading