* [PATCH] vmpressure: Fix subtree pressure detection
@ 2016-01-27 16:28 Vladimir Davydov
2016-01-27 18:47 ` Johannes Weiner
2016-01-28 15:55 ` Michal Hocko
0 siblings, 2 replies; 6+ messages in thread
From: Vladimir Davydov @ 2016-01-27 16:28 UTC (permalink / raw)
To: Andrew Morton; +Cc: Johannes Weiner, Michal Hocko, linux-mm, linux-kernel
When vmpressure is called for the entire subtree under pressure we
mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
when checking if vmpressure work is to be scheduled. This results in
suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
it.
Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
---
mm/vmpressure.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index 9a6c0704211c..149fdf6c5c56 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -248,9 +248,8 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
if (tree) {
spin_lock(&vmpr->sr_lock);
- vmpr->tree_scanned += scanned;
+ scanned = vmpr->tree_scanned += scanned;
vmpr->tree_reclaimed += reclaimed;
- scanned = vmpr->scanned;
spin_unlock(&vmpr->sr_lock);
if (scanned < vmpressure_win)
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] vmpressure: Fix subtree pressure detection
2016-01-27 16:28 [PATCH] vmpressure: Fix subtree pressure detection Vladimir Davydov
@ 2016-01-27 18:47 ` Johannes Weiner
2016-01-28 15:55 ` Michal Hocko
1 sibling, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2016-01-27 18:47 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: Andrew Morton, Michal Hocko, linux-mm, linux-kernel
On Wed, Jan 27, 2016 at 07:28:57PM +0300, Vladimir Davydov wrote:
> When vmpressure is called for the entire subtree under pressure we
> mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
> when checking if vmpressure work is to be scheduled. This results in
> suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
> it.
>
> Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmpressure: Fix subtree pressure detection
2016-01-27 16:28 [PATCH] vmpressure: Fix subtree pressure detection Vladimir Davydov
2016-01-27 18:47 ` Johannes Weiner
@ 2016-01-28 15:55 ` Michal Hocko
2016-01-28 19:24 ` Vlastimil Babka
1 sibling, 1 reply; 6+ messages in thread
From: Michal Hocko @ 2016-01-28 15:55 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: Andrew Morton, Johannes Weiner, linux-mm, linux-kernel
On Wed 27-01-16 19:28:57, Vladimir Davydov wrote:
> When vmpressure is called for the entire subtree under pressure we
> mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
> when checking if vmpressure work is to be scheduled. This results in
> suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
> it.
>
> Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
a = b += c made me scratch my head for a second but this looks correct
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/vmpressure.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/vmpressure.c b/mm/vmpressure.c
> index 9a6c0704211c..149fdf6c5c56 100644
> --- a/mm/vmpressure.c
> +++ b/mm/vmpressure.c
> @@ -248,9 +248,8 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
>
> if (tree) {
> spin_lock(&vmpr->sr_lock);
> - vmpr->tree_scanned += scanned;
> + scanned = vmpr->tree_scanned += scanned;
> vmpr->tree_reclaimed += reclaimed;
> - scanned = vmpr->scanned;
> spin_unlock(&vmpr->sr_lock);
>
> if (scanned < vmpressure_win)
> --
> 2.1.4
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmpressure: Fix subtree pressure detection
2016-01-28 15:55 ` Michal Hocko
@ 2016-01-28 19:24 ` Vlastimil Babka
2016-01-29 8:37 ` Vladimir Davydov
0 siblings, 1 reply; 6+ messages in thread
From: Vlastimil Babka @ 2016-01-28 19:24 UTC (permalink / raw)
To: Michal Hocko, Vladimir Davydov
Cc: Andrew Morton, Johannes Weiner, linux-mm, linux-kernel
On 28.1.2016 16:55, Michal Hocko wrote:
> On Wed 27-01-16 19:28:57, Vladimir Davydov wrote:
>> When vmpressure is called for the entire subtree under pressure we
>> mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
>> when checking if vmpressure work is to be scheduled. This results in
>> suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
>> it.
>>
>> Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
>> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
>
> a = b += c made me scratch my head for a second but this looks correct
Ugh, it's actually a = b += a
While clever and compact, this will make scratch their head anyone looking at
the code in the future. Is it worth it?
> Acked-by: Michal Hocko <mhocko@suse.com>
>
>> ---
>> mm/vmpressure.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/vmpressure.c b/mm/vmpressure.c
>> index 9a6c0704211c..149fdf6c5c56 100644
>> --- a/mm/vmpressure.c
>> +++ b/mm/vmpressure.c
>> @@ -248,9 +248,8 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
>>
>> if (tree) {
>> spin_lock(&vmpr->sr_lock);
>> - vmpr->tree_scanned += scanned;
>> + scanned = vmpr->tree_scanned += scanned;
>> vmpr->tree_reclaimed += reclaimed;
>> - scanned = vmpr->scanned;
>> spin_unlock(&vmpr->sr_lock);
>>
>> if (scanned < vmpressure_win)
>> --
>> 2.1.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmpressure: Fix subtree pressure detection
2016-01-28 19:24 ` Vlastimil Babka
@ 2016-01-29 8:37 ` Vladimir Davydov
2016-02-02 6:32 ` Andrew Morton
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Davydov @ 2016-01-29 8:37 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Michal Hocko, Andrew Morton, Johannes Weiner, linux-mm, linux-kernel
On Thu, Jan 28, 2016 at 08:24:30PM +0100, Vlastimil Babka wrote:
> On 28.1.2016 16:55, Michal Hocko wrote:
> > On Wed 27-01-16 19:28:57, Vladimir Davydov wrote:
> >> When vmpressure is called for the entire subtree under pressure we
> >> mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
> >> when checking if vmpressure work is to be scheduled. This results in
> >> suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
> >> it.
> >>
> >> Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
> >> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
> >
> > a = b += c made me scratch my head for a second but this looks correct
>
> Ugh, it's actually a = b += a
>
> While clever and compact, this will make scratch their head anyone looking at
> the code in the future. Is it worth it?
I'm just trying to be consistend with the !tree case, where we do
exactly the same.
Thanks,
Vladimir
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmpressure: Fix subtree pressure detection
2016-01-29 8:37 ` Vladimir Davydov
@ 2016-02-02 6:32 ` Andrew Morton
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2016-02-02 6:32 UTC (permalink / raw)
To: Vladimir Davydov
Cc: Vlastimil Babka, Michal Hocko, Johannes Weiner, linux-mm, linux-kernel
On Fri, 29 Jan 2016 11:37:49 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
> On Thu, Jan 28, 2016 at 08:24:30PM +0100, Vlastimil Babka wrote:
> > On 28.1.2016 16:55, Michal Hocko wrote:
> > > On Wed 27-01-16 19:28:57, Vladimir Davydov wrote:
> > >> When vmpressure is called for the entire subtree under pressure we
> > >> mistakenly use vmpressure->scanned instead of vmpressure->tree_scanned
> > >> when checking if vmpressure work is to be scheduled. This results in
> > >> suppressing all vmpressure events in the legacy cgroup hierarchy. Fix
> > >> it.
> > >>
> > >> Fixes: 8e8ae645249b ("mm: memcontrol: hook up vmpressure to socket pressure")
> > >> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
> > >
> > > a = b += c made me scratch my head for a second but this looks correct
> >
> > Ugh, it's actually a = b += a
> >
> > While clever and compact, this will make scratch their head anyone looking at
> > the code in the future. Is it worth it?
>
> I'm just trying to be consistend with the !tree case, where we do
> exactly the same.
I stared suspiciously at it for a while, decided to let it go.
Possibly we can remove local `scanned' altogether. No matter, someone
will clean it all up sometime.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-02 6:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-27 16:28 [PATCH] vmpressure: Fix subtree pressure detection Vladimir Davydov
2016-01-27 18:47 ` Johannes Weiner
2016-01-28 15:55 ` Michal Hocko
2016-01-28 19:24 ` Vlastimil Babka
2016-01-29 8:37 ` Vladimir Davydov
2016-02-02 6:32 ` Andrew Morton
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).