From: Andrew Morton <akpm@linux-foundation.org>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: dledford@redhat.com, kosaki.motohiro@jp.fujitsu.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc/mqueue: use correct gfp flags in msg_insert
Date: Mon, 14 May 2012 16:54:01 -0700 [thread overview]
Message-ID: <20120514165401.e4efc2fd.akpm@linux-foundation.org> (raw)
In-Reply-To: <1337029525-8760-1-git-send-email-levinsasha928@gmail.com>
On Mon, 14 May 2012 23:05:25 +0200
Sasha Levin <levinsasha928@gmail.com> wrote:
> msg_insert() tries to allocate using GFP_KERNEL, while in both cases when it's called,
> it's coming from an atomic context. Introduced by 7dd7edf ("ipc/mqueue: improve
> performance of send/recv").
>
> Use GFP_ATOMIC instead.
>
> Also, fix up coding style in the kzalloc while we're there.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> ipc/mqueue.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 30f6f8f..9ec6896 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -133,7 +133,7 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info)
> else
> p = &(*p)->rb_right;
> }
> - leaf = kzalloc(sizeof(struct posix_msg_tree_node), GFP_KERNEL);
> + leaf = kzalloc(sizeof(*leaf), GFP_ATOMIC);
> if (!leaf)
> return -ENOMEM;
> rb_init_node(&leaf->rb_node);
hm, that should have spewed warnings everywhere the first time anyone
tested it. Doug, is a re-read of Documentation/SubmitChecklist needed?
Switching to GFP_ATOMIC is a bit regrettable. Can we avoid this by
speculatively allocating the memory before taking the lock, then free
it again if we ended up not using it?
next prev parent reply other threads:[~2012-05-14 23:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 21:05 Sasha Levin
2012-05-14 23:54 ` Andrew Morton [this message]
2012-05-15 2:45 ` Doug Ledford
2012-05-15 21:38 ` Andrew Morton
2012-05-16 4:37 ` Doug Ledford
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=20120514165401.e4efc2fd.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dledford@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome