linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: js1304@gmail.com, Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first in movable allocation
Date: Thu, 13 Oct 2016 11:12:10 +0200	[thread overview]
Message-ID: <2567dd30-89c7-b9d2-c327-5dec8c536040@suse.cz> (raw)
In-Reply-To: <1476346102-26928-3-git-send-email-iamjoonsoo.kim@lge.com>

On 10/13/2016 10:08 AM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> When we try to find freepage in fallback buddy list, we always serach
> the largest one. This would help for fragmentation if we process
> unmovable/reclaimable allocation request because it could cause permanent
> fragmentation on movable pageblock and spread out such allocations would
> cause more fragmentation. But, movable allocation request is
> rather different. It would be simply freed or migrated so it doesn't
> contribute to fragmentation on the other pageblock. In this case, it would
> be better not to break the precious highest order freepage so we need to
> search the smallest freepage first.

I've also pondered this, but then found a lower hanging fruit that 
should be hopefully clear win and mitigate most cases of breaking 
high-order pages unnecessarily:

http://marc.info/?l=linux-mm&m=147582914330198&w=2

So I would try that first, and then test your patch on top? In your 
patch there's a risk that we make it harder for unmovable/reclaimable 
pageblocks to become movable again (we start with the smallest page 
which means there's lower chance that move_freepages_block() will 
convert more than half of the block). And Johannes's report seems to be 
about a regression in exactly this aspect of the heuristics.

> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  mm/page_alloc.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c4f7d05..70427bf 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2121,15 +2121,31 @@ static void unreserve_highatomic_pageblock(const struct alloc_context *ac)
>  	int fallback_mt;
>  	bool can_steal;
>
> -	/* Find the largest possible block of pages in the other list */
> -	for (current_order = MAX_ORDER-1;
> -				current_order >= order && current_order <= MAX_ORDER-1;
> -				--current_order) {
> +	if (start_migratetype == MIGRATE_MOVABLE)
> +		current_order = order;
> +	else
> +		current_order = MAX_ORDER - 1;
> +
> +	/*
> +	 * Find the appropriate block of pages in the other list.
> +	 * If start_migratetype is MIGRATE_UNMOVABLE/MIGRATE_RECLAIMABLE,
> +	 * it would be better to find largest pageblock since it could cause
> +	 * fragmentation. However, in case of MIGRATE_MOVABLE, there is no
> +	 * risk about fragmentation so it would be better to use smallest one.
> +	 */
> +	while (current_order >= order && current_order <= MAX_ORDER - 1) {
> +
>  		area = &(zone->free_area[current_order]);
>  		fallback_mt = find_suitable_fallback(area, current_order,
>  				start_migratetype, false, &can_steal);
> -		if (fallback_mt == -1)
> +		if (fallback_mt == -1) {
> +			if (start_migratetype == MIGRATE_MOVABLE)
> +				current_order++;
> +			else
> +				current_order--;
> +
>  			continue;
> +		}
>
>  		page = list_first_entry(&area->free_list[fallback_mt],
>  						struct page, lru);
>

--
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-10-13  9:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  8:08 [RFC PATCH 0/5] Reduce fragmentation js1304
2016-10-13  8:08 ` [RFC PATCH 1/5] mm/page_alloc: always add freeing page at the tail of the buddy list js1304
2016-10-13  9:04   ` Vlastimil Babka
2016-10-14  1:01     ` Joonsoo Kim
2016-10-17  9:21   ` Xishi Qiu
2016-10-26  4:37     ` Joonsoo Kim
2016-10-26  5:50       ` Xishi Qiu
2016-10-26  5:59         ` Joonsoo Kim
2016-10-26  6:08           ` Xishi Qiu
2016-10-13  8:08 ` [RFC PATCH 2/5] mm/page_alloc: use smallest fallback page first in movable allocation js1304
2016-10-13  9:12   ` Vlastimil Babka [this message]
2016-10-14  1:26     ` Joonsoo Kim
2016-10-14 10:52       ` Vlastimil Babka
2016-10-26  4:41         ` Joonsoo Kim
2016-10-13  8:08 ` [RFC PATCH 3/5] mm/page_alloc: stop instantly reusing freed page js1304
2016-10-13 10:59   ` Vlastimil Babka
2016-10-14  1:28     ` Joonsoo Kim
2016-10-13  8:08 ` [RFC PATCH 4/5] mm/page_alloc: add fixed migratetype pageblock infrastructure js1304
2016-10-13  8:08 ` [RFC PATCH 5/5] mm/page_alloc: support fixed migratetype pageblock js1304
2016-10-13 11:05   ` Vlastimil Babka
2016-10-14  1:58     ` Joonsoo Kim

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=2567dd30-89c7-b9d2-c327-5dec8c536040@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    /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