From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
werner <w.landgraf@ru.ru>, Rik van Riel <riel@redhat.com>,
Hugh Dickins <hughd@google.com>,
linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
Rabin Vincent <rabin.vincent@stericsson.com>,
Christian Bejram <christian.bejram@stericsson.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Anton Vorontsov <anton.vorontsov@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: v3.4-rc2 out-of-memory problems (was Re: 3.4-rc1 sticks-and-crashs)
Date: Sun, 15 Apr 2012 02:20:11 +0530 [thread overview]
Message-ID: <4F89E303.1060603@linux.vnet.ibm.com> (raw)
In-Reply-To: <CA+55aFwa40cv_TYdU3dKHPPJQo2omLpi8y6k6KBhJ5uP12f29A@mail.gmail.com>
On 04/10/2012 05:25 AM, Linus Torvalds wrote:
> On Mon, Apr 9, 2012 at 4:25 PM, David Rientjes <rientjes@google.com> wrote:
>>
>> You could that if you also turned the check for "ret == NOTIFY_OK" in
>> profile_handoff_task() into "ret & NOTIFY_OK" in your patch, otherwise you
>> get a double free from __put_task_struct() and oprofile.
>
> Why? NOTIFY_DONE is zero.
>
> I do agree that we *also* could do the "& NOTIFY_OK" and make it
> clearer that we're oring bits together. And we could document the
> stupid notifier interfaces to do this all, and just make the rules be
> *sane* when you have multiple notifiers.
>
> And sane rules would be either:
>
> - you always return an error return, and notifiers all return either
> 0 or a negative error number, and we stop on the first error and
> return that.
>
> - you return a bitmask, and we or all bits together (and we can
> certainly continue to have a "stop here" bit)
>
Even I think 'or'ing the bits makes more sense than returning the last
return value.
CPU hotplug and suspend/resume are two of the things that I know of,
that use notifiers quite a bit. However, neither of them actually care
about the exact return value - if it is an error return, no matter which
one or for what reason, they do the same error handling; and it works
for them. IOW, if we change the documented behaviour of notifiers to
return 'or' of all return values, that would continue to work well
with these users.
Of course, there are other users like profile_handoff_task() that do
care about exactly what the return value was, but I guess we can
gradually adapt such users to the better, saner rules for the notifier
return values, as you proposed.
> But the current notifier semantics are just insane. The whole "we
> return the last return value" is crazy. It's by definition a random
> number, since the whole point of notifiers is that there can be
> multiple, and they aren't "ordered". So the whole "last return value"
> is something I just look at and say: "Whoever designed that is a
> f*cking moron".
>
[...]
>
> Again, almost every notifier user has always been total crap. It's
> just a stupid abstraction.
> "Something happened". "Oh, ok".
>
Never saw such a concise and apt definition of notifiers before ;-)
However, unfortunately, what other better mechanism do we have, to
deal with things that affect stuff across multiple subsystems, like
some of the users mentioned above? Hmm...
Regards,
Srivatsa S. Bhat
next prev parent reply other threads:[~2012-04-14 20:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+55aFwTFXtMLhXo7g9F7uyHc3W8SCw7z1gTm9jbWXM3Nqc_ZA@mail.gmail.com>
[not found] ` <20120408195044.13ea6c8e.akpm@linux-foundation.org>
[not found] ` <CA+55aFw7GsiZbNW84WVMUMT6C0Sw82jxaYxeaaB8qq=41Ep5Wg@mail.gmail.com>
2012-04-09 10:15 ` v3.4-rc2 out-of-memory problems (was Re: 3.4-rc1 sticks-and-crashs) David Rientjes
2012-04-09 15:39 ` Linus Torvalds
2012-04-09 21:22 ` David Rientjes
2012-04-09 22:09 ` Linus Torvalds
2012-04-09 23:25 ` David Rientjes
2012-04-09 23:55 ` Linus Torvalds
2012-04-10 0:04 ` David Rientjes
2012-04-14 20:50 ` Srivatsa S. Bhat [this message]
2012-04-09 23:56 ` [patch] android, lowmemorykiller: remove task handoff notifier David Rientjes
2012-04-10 1:23 ` Colin Cross
[not found] ` <web-723076709@zbackend1.aha.ru>
[not found] ` <alpine.DEB.2.00.1204091637280.21813@chino.kir.corp.google.com>
[not found] ` <web-723082731@zbackend1.aha.ru>
[not found] ` <alpine.DEB.2.00.1204091707580.21813@chino.kir.corp.google.com>
2012-04-10 7:09 ` v3.4-rc2 out-of-memory problems (was Re: 3.4-rc1 sticks-and-crashs) werner
2012-04-10 7:10 ` werner
2012-04-09 22:13 ` Colin Cross
2012-04-09 22:21 ` Greg Kroah-Hartman
2012-04-09 22:44 ` john stultz
2012-04-09 22:30 ` Linus Torvalds
2012-04-09 23:37 ` David Rientjes
2012-04-10 0:23 ` Colin Cross
2012-04-10 0:32 ` David Rientjes
2012-04-10 1:21 ` Colin Cross
2012-04-10 1:33 ` David Rientjes
2012-04-10 1:37 ` Colin Cross
2012-04-10 1:52 werner
2012-04-10 1:51 ` Rik van Riel
2012-04-10 2:13 ` werner
-- strict thread matches above, loose matches on Subject: below --
2012-04-10 12:53 werner
2012-04-14 19:38 werner
2012-04-14 19:58 ` Rik van Riel
2012-04-14 21:03 ` Linus Torvalds
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=4F89E303.1060603@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=anton.vorontsov@linaro.org \
--cc=christian.bejram@stericsson.com \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rabin.vincent@stericsson.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=rjw@sisk.pl \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=w.landgraf@ru.ru \
/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 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).