From: Xishi Qiu <qiuxishi@huawei.com>
To: js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [RFC PATCH 1/5] mm/page_alloc: always add freeing page at the tail of the buddy list
Date: Mon, 17 Oct 2016 17:21:54 +0800 [thread overview]
Message-ID: <58049832.6000007@huawei.com> (raw)
In-Reply-To: <1476346102-26928-2-git-send-email-iamjoonsoo.kim@lge.com>
On 2016/10/13 16:08, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> Currently, freeing page can stay longer in the buddy list if next higher
> order page is in the buddy list in order to help coalescence. However,
> it doesn't work for the simplest sequential free case. For example, think
> about the situation that 8 consecutive pages are freed in sequential
> order.
>
> page 0: attached at the head of order 0 list
> page 1: merged with page 0, attached at the head of order 1 list
> page 2: attached at the tail of order 0 list
> page 3: merged with page 2 and then merged with page 0, attached at
> the head of order 2 list
> page 4: attached at the head of order 0 list
> page 5: merged with page 4, attached at the tail of order 1 list
> page 6: attached at the tail of order 0 list
> page 7: merged with page 6 and then merged with page 4. Lastly, merged
> with page 0 and we get order 3 freepage.
>
> With excluding page 0 case, there are three cases that freeing page is
> attached at the head of buddy list in this example and if just one
> corresponding ordered allocation request comes at that moment, this page
> in being a high order page will be allocated and we would fail to make
> order-3 freepage.
>
> Allocation usually happens in sequential order and free also does. So, it
> would be important to detect such a situation and to give some chance
> to be coalesced.
>
> I think that simple and effective heuristic about this case is just
> attaching freeing page at the tail of the buddy list unconditionally.
> If freeing isn't merged during one rotation, it would be actual
> fragmentation and we don't need to care about it for coalescence.
>
Hi Joonsoo,
I find another two places to reduce fragmentation.
1)
__rmqueue_fallback
steal_suitable_fallback
move_freepages_block
move_freepages
list_move
If we steal some free pages, we will add these page at the head of start_migratetype list,
this will cause more fixed migratetype, because this pages will be allocated more easily.
So how about use list_move_tail instead of list_move?
2)
__rmqueue_fallback
expand
list_add
How about use list_add_tail instead of list_add? If add the tail, then the rest of pages
will be hard to be allocated and we can merge them again as soon as the page freed.
Thanks,
Xishi Qiu
--
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>
next prev parent reply other threads:[~2016-10-17 10:17 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 [this message]
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
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=58049832.6000007@huawei.com \
--to=qiuxishi@huawei.com \
--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 \
--cc=vbabka@suse.cz \
/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).