Re: [PATCH 2/2] mm: memcontrol - uninitialised return value

From: Kirill A. Shutemov
Date: Fri May 07 2010 - 01:15:29 EST


On Fri, May 7, 2010 at 4:07 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> On Thu, 6 May 2010 14:24:17 -0700
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>> On Wed, Â5 May 2010 14:21:49 +0300
>> Phil Carmody <ext-phil.2.carmody@xxxxxxxxx> wrote:
>>
>> > From: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
>> >
>> > Only an out of memory error will cause ret to be set.
>> >
>> > Acked-by: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
>> > Signed-off-by: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
>> > ---
>> > Âmm/memcontrol.c | Â Â2 +-
>> > Â1 files changed, 1 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> > index 90e32b2..09af773 100644
>> > --- a/mm/memcontrol.c
>> > +++ b/mm/memcontrol.c
>> > @@ -3464,7 +3464,7 @@ static int mem_cgroup_unregister_event(struct cgroup *cgrp, struct cftype *cft,
>> > Â Â int type = MEMFILE_TYPE(cft->private);
>> > Â Â u64 usage;
>> > Â Â int size = 0;
>> > - Â int i, j, ret;
>> > + Â int i, j, ret = 0;
>> >
>> > Â Â mutex_lock(&memcg->thresholds_lock);
>> > Â Â if (type == _MEM)
>>
>> afacit the return value of cftype.unregister_event() is always ignored
>> anyway. ÂPerhaps it should be changed to void-returning, or fixed.
>>
>>
> Ah, it's now "TODO". But hmm...."unregister_event()" is called by workqueue.
> (for avoiding race?)

Because it can be called from atomic context.

> I think unregister_event should be "void" and mem_cgroup_unregister_event()
> should be implemented as "never fail" function.
>
> I'll try by myself....but if someone knows this event notifier implementation well,
> please.

Ok, better if I'll do it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/