linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Wenwei Tao <wwtao0320@163.com>,
	akpm@linux-foundation.org, mgorman@techsingularity.net,
	mhocko@suse.com, rientjes@google.com,
	kirill.shutemov@linux.intel.com, iamjoonsoo.kim@lge.com,
	izumi.taku@jp.fujitsu.com, hannes@cmpxchg.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, ww.tao0320@gmail.com
Subject: Re: [RFC PATCH 1/3] mm, page_alloc: free HIGHATOMIC page directly to the allocator
Date: Sat, 18 Jun 2016 12:14:39 +0200	[thread overview]
Message-ID: <57651F0F.2010506@suse.cz> (raw)
In-Reply-To: <1466242457-2440-1-git-send-email-wwtao0320@163.com>

On 06/18/2016 11:34 AM, Wenwei Tao wrote:
> From: Wenwei Tao <ww.tao0320@gmail.com>
> 
> Some pages might have already been allocated before reserve
> the pageblock as HIGHATOMIC. When free these pages, put them
> directly to the allocator instead of the pcp lists since they
> might have the chance to be merged to high order pages.

Are there some data showing the improvement, or just theoretical?

> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
>  mm/page_alloc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6903b69..19f9e76 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2412,7 +2412,8 @@ void free_hot_cold_page(struct page *page, bool cold)

The full comment that's here for context:

/*
 * We only track unmovable, reclaimable and movable on pcp lists.
 * Free ISOLATE pages back to the allocator because they are being
 * offlined but treat RESERVE as movable pages so we can get those
 * areas back if necessary. Otherwise, we may have to free
 * excessively into the page allocator
 */

That comment looks outdated as it refers to RESERVE, which was replaced
by HIGHATOMIC. But there's some reasoning why these pages go to
pcplists. I'd expect the "free excessively" part isn't as bad as
highatomic reserves are quite limited. They also shouldn't be used for
order-0 allocations, which is what this function is about, so I would
expect both the impact on "free excessively" and the improvement of
merging to be minimal?

>  	 * excessively into the page allocator
>  	 */
>  	if (migratetype >= MIGRATE_PCPTYPES) {
> -		if (unlikely(is_migrate_isolate(migratetype))) {
> +		if (unlikely(is_migrate_isolate(migratetype) ||
> +				migratetype == MIGRATE_HIGHATOMIC)) {
>  			free_one_page(zone, page, pfn, 0, migratetype);
>  			goto out;
>  		}

In any case your patch highlighted that this code could be imho
optimized like below.

if (unlikely(migratetype >= MIGRATE_PCPTYPES))
   if (is_migrate_cma(migratetype)) {
       migratetype = MIGRATE_MOVABLE;
   } else {
       free_one_page(zone, page, pfn, 0, migratetype);
       goto out;
   }
}

That's less branches than your patch, and even less than originally if
CMA is not enabled (or with ZONE_CMA).

--
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>

  reply	other threads:[~2016-06-18 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18  9:34 [RFC PATCH 1/3] mm, page_alloc: free HIGHATOMIC page directly to the allocator Wenwei Tao
2016-06-18 10:14 ` Vlastimil Babka [this message]
     [not found]   ` <CACygaLAU-PiB8UDR0i9FYbTuH8vBKJRFxufGOVoWCmqPad-XZQ@mail.gmail.com>
2016-06-19  2:49     ` Fwd: " Wenwei Tao
2016-06-19  1:48 ` [RFC PATCH 2/3] mm, page_alloc: get page migreate type again when related to highatomic Wenwei Tao
2016-06-19  1:51   ` [RFC PATCH 3/3] mm, page_alloc: prevent merge freepages between highatomic and others Wenwei Tao

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=57651F0F.2010506@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=ww.tao0320@gmail.com \
    --cc=wwtao0320@163.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;
as well as URLs for NNTP newsgroup(s).