From: Vlastimil Babka <vbabka@suse.cz>
To: Yaowei Bai <bywxiaobai@163.com>,
akpm@linux-foundation.org, mgorman@suse.de, mhocko@kernel.org,
rientjes@google.com, hannes@cmpxchg.org, vdavydov@parallels.com,
oleg@redhat.com, iamjoonsoo.kim@lge.com,
zhangyanfei@cn.fujitsu.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function
Date: Wed, 23 Sep 2015 18:42:53 +0200 [thread overview]
Message-ID: <5602D68D.7060902@suse.cz> (raw)
In-Reply-To: <1442404800-4051-3-git-send-email-bywxiaobai@163.com>
On 09/16/2015 02:00 PM, Yaowei Bai wrote:
> Introduce is_via_compact_memory helper function indicating compacting
> via /proc/sys/vm/compact_memory to improve readability.
Note that it can also be through single node, i.e.
/sys/devices/system/node/node0/compact
is_manual_compaction() would perhaps be better name
> To catch this situation in __compaction_suitable, use order as parameter
> directly instead of using struct compact_control.
That can be fixed as well. Remove the test from __compaction_suitable(),
and in compact_zone(), do something like:
ret = is_manual_compaction() ? COMPACT_CONTINUE : compaction_suitable()
I think it's better since it's more explicit, but I understand others
might feel differently.
> This patch has no functional changes.
>
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
> ---
> mm/compaction.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index c5c627a..a8e6593 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1197,6 +1197,15 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
> return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE;
> }
>
> +/*
> + * order == -1 is expected when compacting via
> + * /proc/sys/vm/compact_memory
> + */
> +static inline bool is_via_compact_memory(int order)
> +{
> + return order == -1;
> +}
> +
> static int __compact_finished(struct zone *zone, struct compact_control *cc,
> const int migratetype)
> {
> @@ -1223,11 +1232,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc,
> return COMPACT_COMPLETE;
> }
>
> - /*
> - * order == -1 is expected when compacting via
> - * /proc/sys/vm/compact_memory
> - */
> - if (cc->order == -1)
> + if (is_via_compact_memory(cc->order))
> return COMPACT_CONTINUE;
>
> /* Compaction run is not finished if the watermark is not met */
> @@ -1290,11 +1295,7 @@ static unsigned long __compaction_suitable(struct zone *zone, int order,
> int fragindex;
> unsigned long watermark;
>
> - /*
> - * order == -1 is expected when compacting via
> - * /proc/sys/vm/compact_memory
> - */
> - if (order == -1)
> + if (is_via_compact_memory(order))
> return COMPACT_CONTINUE;
>
> watermark = low_wmark_pages(zone);
> @@ -1658,10 +1659,11 @@ static void __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc)
> * this makes sure we compact the whole zone regardless of
> * cached scanner positions.
> */
> - if (cc->order == -1)
> + if (is_via_compact_memory(cc->order))
> __reset_isolation_suitable(zone);
>
> - if (cc->order == -1 || !compaction_deferred(zone, cc->order))
> + if (is_via_compact_memory(cc->order) ||
> + !compaction_deferred(zone, cc->order))
> compact_zone(zone, cc);
>
> if (cc->order > 0) {
>
--
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:[~2015-09-23 16:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 11:59 [PATCH 1/3] mm/vmscan: make inactive_anon_is_low_global return directly Yaowei Bai
2015-09-16 11:59 ` [PATCH 2/3] mm/oom_kill: introduce is_sysrq_oom helper Yaowei Bai
2015-09-21 16:18 ` Michal Hocko
2015-09-21 23:02 ` David Rientjes
2015-09-16 12:00 ` [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function Yaowei Bai
2015-09-21 16:19 ` Michal Hocko
2015-09-21 23:03 ` David Rientjes
2015-09-23 16:42 ` Vlastimil Babka [this message]
2015-09-21 16:18 ` [PATCH 1/3] mm/vmscan: make inactive_anon_is_low_global return directly Michal Hocko
2015-09-22 13:15 ` Yaowei Bai
2015-09-21 23:01 ` David Rientjes
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=5602D68D.7060902@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=bywxiaobai@163.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=rientjes@google.com \
--cc=vdavydov@parallels.com \
--cc=zhangyanfei@cn.fujitsu.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).