All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, mhocko@suse.com, mgorman@techsingularity.net
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>
Subject: [PATCH] mm: get pfn by page_to_pfn() instead of save in page->private
Date: Thu, 18 Oct 2018 21:04:29 +0800	[thread overview]
Message-ID: <20181018130429.37837-1-richard.weiyang@gmail.com> (raw)

This is not necessary to save the pfn to page->private.

The pfn could be retrieved by page_to_pfn() directly.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
Maybe I missed some critical reason to save pfn to private.

Thanks in advance if someone could reveal the special reason.
---
 mm/page_alloc.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 15ea511fb41c..a398eafbae46 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2793,24 +2793,19 @@ void free_unref_page(struct page *page)
 void free_unref_page_list(struct list_head *list)
 {
 	struct page *page, *next;
-	unsigned long flags, pfn;
+	unsigned long flags;
 	int batch_count = 0;
 
 	/* Prepare pages for freeing */
-	list_for_each_entry_safe(page, next, list, lru) {
-		pfn = page_to_pfn(page);
-		if (!free_unref_page_prepare(page, pfn))
+	list_for_each_entry_safe(page, next, list, lru)
+		if (!free_unref_page_prepare(page, page_to_pfn(page)))
 			list_del(&page->lru);
-		set_page_private(page, pfn);
-	}
 
 	local_irq_save(flags);
 	list_for_each_entry_safe(page, next, list, lru) {
-		unsigned long pfn = page_private(page);
-
 		set_page_private(page, 0);
 		trace_mm_page_free_batched(page);
-		free_unref_page_commit(page, pfn);
+		free_unref_page_commit(page, page_to_pfn(page));
 
 		/*
 		 * Guard against excessive IRQ disabled times when we get
-- 
2.15.1

             reply	other threads:[~2018-10-18 13:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 13:04 Wei Yang [this message]
2018-10-18 13:10 ` [PATCH] mm: get pfn by page_to_pfn() instead of save in page->private Matthew Wilcox
2018-10-18 13:15 ` Michal Hocko
2018-10-18 14:10   ` Wei Yang
2018-10-18 16:30     ` Michal Hocko
2018-10-19  3:32       ` Wei Yang
2018-10-18 13:39 ` Mel Gorman
2018-10-18 14:19   ` Wei Yang
2018-10-18 14:53     ` Mel Gorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018130429.37837-1-richard.weiyang@gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.