From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
stable@vger.kernel.org, Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: memcontrol: fix possible memcg leak due to interrupted reclaim
Date: Sat, 19 Dec 2015 11:51:38 +0300 [thread overview]
Message-ID: <20151219085137.GV28521@esperanza> (raw)
In-Reply-To: <20151218144004.6ec6189817b64e04d9405001@linux-foundation.org>
On Fri, Dec 18, 2015 at 02:40:04PM -0800, Andrew Morton wrote:
> On Fri, 18 Dec 2015 19:24:05 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
>
> >
> > OK, got it, thanks. Here goes the incremental patch (it should also fix
> > the warning regarding unused cmpxchg returned value):
> > ---
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index fc25dc211eaf..908c075e04eb 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -864,7 +864,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
> > * might block it. So we clear iter->position right
> > * away.
> > */
> > - cmpxchg(&iter->position, pos, NULL);
> > + (void)cmpxchg(&iter->position, pos, NULL);
>
> No, this doesn't actually squish the __must_check warning.
The warning was caused not by a __must_check annotation - using it for
cmpxchg would be just wrong - it was caused by type conversion done in
expansion of cmpxchg macro:
arch/m68k/include/asm/cmpxchg.h:121:3: warning: value computed is not used [-Wunused-value]
((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
^
(see http://www.spinics.net/lists/linux-mm/msg99133.html)
Type conversion to (void) helps suppressing this warning, and it seems
this is what is done commonly (e.g. see kernel/rcu/tree_plugin.h)
Thanks,
Vladimir
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>, <stable@vger.kernel.org>,
Michal Hocko <mhocko@kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm: memcontrol: fix possible memcg leak due to interrupted reclaim
Date: Sat, 19 Dec 2015 11:51:38 +0300 [thread overview]
Message-ID: <20151219085137.GV28521@esperanza> (raw)
In-Reply-To: <20151218144004.6ec6189817b64e04d9405001@linux-foundation.org>
On Fri, Dec 18, 2015 at 02:40:04PM -0800, Andrew Morton wrote:
> On Fri, 18 Dec 2015 19:24:05 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
>
> >
> > OK, got it, thanks. Here goes the incremental patch (it should also fix
> > the warning regarding unused cmpxchg returned value):
> > ---
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index fc25dc211eaf..908c075e04eb 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -864,7 +864,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
> > * might block it. So we clear iter->position right
> > * away.
> > */
> > - cmpxchg(&iter->position, pos, NULL);
> > + (void)cmpxchg(&iter->position, pos, NULL);
>
> No, this doesn't actually squish the __must_check warning.
The warning was caused not by a __must_check annotation - using it for
cmpxchg would be just wrong - it was caused by type conversion done in
expansion of cmpxchg macro:
arch/m68k/include/asm/cmpxchg.h:121:3: warning: value computed is not used [-Wunused-value]
((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
^
(see http://www.spinics.net/lists/linux-mm/msg99133.html)
Type conversion to (void) helps suppressing this warning, and it seems
this is what is done commonly (e.g. see kernel/rcu/tree_plugin.h)
Thanks,
Vladimir
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>, <stable@vger.kernel.org>,
Michal Hocko <mhocko@kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm: memcontrol: fix possible memcg leak due to interrupted reclaim
Date: Sat, 19 Dec 2015 11:51:38 +0300 [thread overview]
Message-ID: <20151219085137.GV28521@esperanza> (raw)
In-Reply-To: <20151218144004.6ec6189817b64e04d9405001@linux-foundation.org>
On Fri, Dec 18, 2015 at 02:40:04PM -0800, Andrew Morton wrote:
> On Fri, 18 Dec 2015 19:24:05 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
>
> >
> > OK, got it, thanks. Here goes the incremental patch (it should also fix
> > the warning regarding unused cmpxchg returned value):
> > ---
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index fc25dc211eaf..908c075e04eb 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -864,7 +864,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
> > * might block it. So we clear iter->position right
> > * away.
> > */
> > - cmpxchg(&iter->position, pos, NULL);
> > + (void)cmpxchg(&iter->position, pos, NULL);
>
> No, this doesn't actually squish the __must_check warning.
The warning was caused not by a __must_check annotation - using it for
cmpxchg would be just wrong - it was caused by type conversion done in
expansion of cmpxchg macro:
arch/m68k/include/asm/cmpxchg.h:121:3: warning: value computed is not used [-Wunused-value]
((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
^
(see http://www.spinics.net/lists/linux-mm/msg99133.html)
Type conversion to (void) helps suppressing this warning, and it seems
this is what is done commonly (e.g. see kernel/rcu/tree_plugin.h)
Thanks,
Vladimir
--
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-12-19 8:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 12:31 [PATCH v2] mm: memcontrol: fix possible memcg leak due to interrupted reclaim Vladimir Davydov
2015-12-15 12:31 ` Vladimir Davydov
2015-12-15 12:31 ` Vladimir Davydov
2015-12-15 14:53 ` Johannes Weiner
2015-12-15 14:53 ` Johannes Weiner
2015-12-17 23:02 ` Andrew Morton
2015-12-17 23:02 ` Andrew Morton
2015-12-17 23:02 ` Andrew Morton
2015-12-18 15:32 ` Vladimir Davydov
2015-12-18 15:32 ` Vladimir Davydov
2015-12-18 15:32 ` Vladimir Davydov
2015-12-18 16:00 ` Johannes Weiner
2015-12-18 16:00 ` Johannes Weiner
2015-12-18 16:24 ` Vladimir Davydov
2015-12-18 16:24 ` Vladimir Davydov
2015-12-18 16:24 ` Vladimir Davydov
2015-12-18 22:40 ` Andrew Morton
2015-12-18 22:40 ` Andrew Morton
2015-12-18 22:40 ` Andrew Morton
2015-12-19 8:51 ` Vladimir Davydov [this message]
2015-12-19 8:51 ` Vladimir Davydov
2015-12-19 8:51 ` Vladimir Davydov
2015-12-23 22:19 ` Johannes Weiner
2015-12-23 22:19 ` Johannes Weiner
2015-12-23 22:19 ` Johannes Weiner
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=20151219085137.GV28521@esperanza \
--to=vdavydov@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.