From: Vlastimil Babka <vbabka@suse.cz>
To: Geliang Tang <geliangtang@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: use nth_page helper
Date: Fri, 24 Mar 2017 18:43:49 +0100 [thread overview]
Message-ID: <c3dea6d8-4d0d-86d7-d901-398ba7e017ba@suse.cz> (raw)
In-Reply-To: <b75be84c34466eb063bd44ee1ff7f2bf085002b2.1490323567.git.geliangtang@gmail.com>
On 24.3.2017 15:10, Geliang Tang wrote:
> Use nth_page() helper instead of page_to_pfn() and pfn_to_page() to
> simplify the code.
Well I've never heard of this helper so I would have to look it up to see what
it does. Looks like there's not many users.
Anyway it's simpler to use just "page + i" if within MAX_ORDER_NR_PAGES, which
should be the case here. That can also actually save a few cycles. Otherwise it
looks like a pointless churn to me.
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
> mm/page_alloc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f749b7f..3354f56 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2511,9 +2511,8 @@ void mark_free_pages(struct zone *zone)
> &zone->free_area[order].free_list[t], lru) {
> unsigned long i;
>
> - pfn = page_to_pfn(page);
> for (i = 0; i < (1UL << order); i++)
> - swsusp_set_page_free(pfn_to_page(pfn + i));
> + swsusp_set_page_free(nth_page(page, i));
> }
> }
> spin_unlock_irqrestore(&zone->lock, flags);
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-03-24 17:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ab50f7fbf9826ac7275f0513ca04bf1073b41a36.1490323750.git.geliangtang@gmail.com>
2017-03-24 14:10 ` Geliang Tang
2017-03-24 17:43 ` Vlastimil Babka [this message]
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=c3dea6d8-4d0d-86d7-d901-398ba7e017ba@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=geliangtang@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox