* [PATCH] mm: memcontrol: fix order calculation in try_charge()
@ 2015-09-15 12:05 Jerome Marchand
2015-09-15 13:56 ` Michal Hocko
2015-09-18 7:42 ` Johannes Weiner
0 siblings, 2 replies; 4+ messages in thread
From: Jerome Marchand @ 2015-09-15 12:05 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko; +Cc: cgroups, linux-mm, linux-kernel
Since commit <6539cc05386> (mm: memcontrol: fold mem_cgroup_do_charge()),
the order to pass to mem_cgroup_oom() is calculated by passing the number
of pages to get_order() instead of the expected size in bytes. AFAICT,
it only affects the value displayed in the oom warning message.
This patch fix this.
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
mm/memcontrol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1742a2d..91bf094 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2032,7 +2032,8 @@ retry:
mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1);
- mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(nr_pages));
+ mem_cgroup_oom(mem_over_limit, gfp_mask,
+ get_order(nr_pages * PAGE_SIZE));
nomem:
if (!(gfp_mask & __GFP_NOFAIL))
return -ENOMEM;
--
1.9.3
--
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: memcontrol: fix order calculation in try_charge()
2015-09-15 12:05 [PATCH] mm: memcontrol: fix order calculation in try_charge() Jerome Marchand
@ 2015-09-15 13:56 ` Michal Hocko
2015-09-17 13:04 ` Michal Hocko
2015-09-18 7:42 ` Johannes Weiner
1 sibling, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2015-09-15 13:56 UTC (permalink / raw)
To: Jerome Marchand; +Cc: Johannes Weiner, cgroups, linux-mm, linux-kernel
On Tue 15-09-15 14:05:57, Jerome Marchand wrote:
> Since commit <6539cc05386> (mm: memcontrol: fold mem_cgroup_do_charge()),
> the order to pass to mem_cgroup_oom() is calculated by passing the number
> of pages to get_order() instead of the expected size in bytes. AFAICT,
> it only affects the value displayed in the oom warning message.
> This patch fix this.
We haven't noticed that just because the OOM is enabled only for page
faults of order-0 (single page) and get_order work just fine. Thanks for
noticing this. If we ever start triggering OOM on different orders this
would be broken.
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Btw. a quick git grep shows that at least gart_iommu_init is using
number of pages as well. I haven't checked it does that intentionally,
though.
Thanks!
> ---
> mm/memcontrol.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 1742a2d..91bf094 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2032,7 +2032,8 @@ retry:
>
> mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1);
>
> - mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(nr_pages));
> + mem_cgroup_oom(mem_over_limit, gfp_mask,
> + get_order(nr_pages * PAGE_SIZE));
> nomem:
> if (!(gfp_mask & __GFP_NOFAIL))
> return -ENOMEM;
> --
> 1.9.3
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: memcontrol: fix order calculation in try_charge()
2015-09-15 13:56 ` Michal Hocko
@ 2015-09-17 13:04 ` Michal Hocko
0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2015-09-17 13:04 UTC (permalink / raw)
To: Jerome Marchand
Cc: Johannes Weiner, cgroups, linux-mm, linux-kernel, Andrew Morton
[CC Andrew - the patch was posted here
http://lkml.kernel.org/r/1442318757-7141-1-git-send-email-jmarchan%40redhat.com]
On Tue 15-09-15 15:56:23, Michal Hocko wrote:
> On Tue 15-09-15 14:05:57, Jerome Marchand wrote:
> > Since commit <6539cc05386> (mm: memcontrol: fold mem_cgroup_do_charge()),
> > the order to pass to mem_cgroup_oom() is calculated by passing the number
> > of pages to get_order() instead of the expected size in bytes. AFAICT,
> > it only affects the value displayed in the oom warning message.
> > This patch fix this.
>
> We haven't noticed that just because the OOM is enabled only for page
> faults of order-0 (single page) and get_order work just fine. Thanks for
> noticing this. If we ever start triggering OOM on different orders this
> would be broken.
>
> > Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> Btw. a quick git grep shows that at least gart_iommu_init is using
> number of pages as well. I haven't checked it does that intentionally,
> though.
>
> Thanks!
>
> > ---
> > mm/memcontrol.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 1742a2d..91bf094 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2032,7 +2032,8 @@ retry:
> >
> > mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1);
> >
> > - mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(nr_pages));
> > + mem_cgroup_oom(mem_over_limit, gfp_mask,
> > + get_order(nr_pages * PAGE_SIZE));
> > nomem:
> > if (!(gfp_mask & __GFP_NOFAIL))
> > return -ENOMEM;
> > --
> > 1.9.3
>
> --
> Michal Hocko
> SUSE Labs
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: memcontrol: fix order calculation in try_charge()
2015-09-15 12:05 [PATCH] mm: memcontrol: fix order calculation in try_charge() Jerome Marchand
2015-09-15 13:56 ` Michal Hocko
@ 2015-09-18 7:42 ` Johannes Weiner
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2015-09-18 7:42 UTC (permalink / raw)
To: Jerome Marchand; +Cc: Michal Hocko, cgroups, linux-mm, linux-kernel
On Tue, Sep 15, 2015 at 02:05:57PM +0200, Jerome Marchand wrote:
> Since commit <6539cc05386> (mm: memcontrol: fold mem_cgroup_do_charge()),
> the order to pass to mem_cgroup_oom() is calculated by passing the number
> of pages to get_order() instead of the expected size in bytes. AFAICT,
> it only affects the value displayed in the oom warning message.
> This patch fix this.
>
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Thanks, Jerome. One minor thing:
> @@ -2032,7 +2032,8 @@ retry:
>
> mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1);
>
> - mem_cgroup_oom(mem_over_limit, gfp_mask, get_order(nr_pages));
> + mem_cgroup_oom(mem_over_limit, gfp_mask,
> + get_order(nr_pages * PAGE_SIZE));
fls(nr_pages)?
get_order() is basically fls(x / PAGE_SIZE).
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-18 7:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 12:05 [PATCH] mm: memcontrol: fix order calculation in try_charge() Jerome Marchand
2015-09-15 13:56 ` Michal Hocko
2015-09-17 13:04 ` Michal Hocko
2015-09-18 7:42 ` Johannes Weiner
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).