Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226042 > unrolled thread
| Started by | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| First post | 2015-09-16 14:20 +0200 |
| Last post | 2015-09-23 18:50 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function Yaowei Bai <bywxiaobai@163.com> - 2015-09-16 14:20 +0200
Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function Michal Hocko <mhocko@kernel.org> - 2015-09-21 18:20 +0200
Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function David Rientjes <rientjes@google.com> - 2015-09-22 01:10 +0200
Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function Vlastimil Babka <vbabka@suse.cz> - 2015-09-23 18:50 +0200
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-16 14:20 +0200 |
| Subject | [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function |
| Message-ID | <q9jQS-4b3-19@gated-at.bofh.it> |
Introduce is_via_compact_memory helper function indicating compacting
via /proc/sys/vm/compact_memory to improve readability.
To catch this situation in __compaction_suitable, use order as parameter
directly instead of using struct compact_control.
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) {
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-09-21 18:20 +0200 |
| Subject | Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function |
| Message-ID | <qbbYT-3k6-43@gated-at.bofh.it> |
| In reply to | #1226042 |
On Wed 16-09-15 20:00:00, Yaowei Bai wrote:
> Introduce is_via_compact_memory helper function indicating compacting
> via /proc/sys/vm/compact_memory to improve readability.
>
> To catch this situation in __compaction_suitable, use order as parameter
> directly instead of using struct compact_control.
>
> This patch has no functional changes.
This is a similar case as for the sysrq_oom. I do not like the name that
much though. I am not familiar with the compaction too much to help you
with a better name, unfortunatelly. Maybe is_global_compaction()...
>
> 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) {
> --
> 1.9.1
>
>
> --
> 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>
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Date | 2015-09-22 01:10 +0200 |
| Subject | Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function |
| Message-ID | <qbinD-4dy-15@gated-at.bofh.it> |
| In reply to | #1226042 |
On Wed, 16 Sep 2015, Yaowei Bai wrote: > Introduce is_via_compact_memory helper function indicating compacting > via /proc/sys/vm/compact_memory to improve readability. > > To catch this situation in __compaction_suitable, use order as parameter > directly instead of using struct compact_control. > > This patch has no functional changes. > > Signed-off-by: Yaowei Bai <bywxiaobai@163.com> Acked-by: David Rientjes <rientjes@google.com> Thanks for doing these cleanups! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2015-09-23 18:50 +0200 |
| Subject | Re: [PATCH 3/3] mm/compaction: add an is_via_compact_memory helper function |
| Message-ID | <qbVp0-1qv-3@gated-at.bofh.it> |
| In reply to | #1226042 |
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web