From: Andrew Morton <akpm@osdl.org>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: linux-mm@kvack.org
Subject: Re: [patch] out of memory notifier - 2nd try.
Date: Tue, 11 Jul 2006 04:12:09 -0700 [thread overview]
Message-ID: <20060711041209.1c9cee49.akpm@osdl.org> (raw)
In-Reply-To: <20060711105148.GA28648@skybase>
On Tue, 11 Jul 2006 12:51:48 +0200
Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
> Hi folks,
> I did not get any negative nor positive feedback on my proposed out of
> memory notifier patch. I'm optimistic that this means that nobody has
> anything against it ..
I have some negative feedback! ;)
> cmm_alloc_pages(long pages, long *counter, struct cmm_page_array **list)
> {
> - struct cmm_page_array *pa;
> + struct cmm_page_array *pa, *npa;
> unsigned long page;
>
> - pa = *list;
> while (pages) {
> page = __get_free_page(GFP_NOIO);
There's a strong convention of
struct page *page;
struct page *pages;
Calling your locals which don't point at struct page's "page" makes the
code harder to follow for experienced kernel developers.
> static int
> cmm_thread(void *dummy)
> {
> @@ -419,6 +452,7 @@ cmm_init (void)
> #ifdef CONFIG_CMM_IUCV
> smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
> #endif
> + register_oom_notifier(&cmm_oom_nb);
> INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, NULL);
> init_waitqueue_head(&cmm_thread_wait);
> init_timer(&cmm_timer);
> @@ -428,6 +462,7 @@ cmm_init (void)
> static void
> cmm_exit(void)
> {
> + unregister_oom_notifier(&cmm_oom_nb);
But I think the oom-handler callback could be executing while it gets
unregistered and rmmodded.
> +static struct notifier_block *oom_notify_list = 0;
Unneeded initialisation.
> +int register_oom_notifier(struct notifier_block *nb)
> +{
> + return notifier_chain_register(&oom_notify_list, nb);
> +}
> +EXPORT_SYMBOL_GPL(register_oom_notifier);
> +
> +int unregister_oom_notifier(struct notifier_block *nb)
> +{
> + return notifier_chain_unregister(&oom_notify_list, nb);
> +}
> +EXPORT_SYMBOL_GPL(unregister_oom_notifier);
If one of the locked notifier-chain APIs was used (ie: blocking_notifier*),
I think the above race wouldn't be present.
--
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:[~2006-07-11 11:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-11 10:51 Martin Schwidefsky
2006-07-11 11:12 ` Andrew Morton [this message]
2006-07-11 11:14 ` Martin Schwidefsky
2006-07-11 14:21 ` Martin Schwidefsky
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=20060711041209.1c9cee49.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-mm@kvack.org \
--cc=schwidefsky@de.ibm.com \
/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