From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>,
Wanpeng Li <liwanp@linux.vnet.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@suse.cz>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH 1/2] mm/mmu_notifier: init notifier if necessary
Date: Fri, 31 Aug 2012 09:07:01 +0800 [thread overview]
Message-ID: <20120831010701.GA5026@shangw.(null)> (raw)
In-Reply-To: <20120830121302.492732d2.akpm@linux-foundation.org>
On Thu, Aug 30, 2012 at 12:13:02PM -0700, Andrew Morton wrote:
>On Sat, 25 Aug 2012 17:47:50 +0800
>Gavin Shan <shangw@linux.vnet.ibm.com> wrote:
>
>> >> --- a/mm/mmu_notifier.c
>> >> +++ b/mm/mmu_notifier.c
>> >> @@ -192,22 +192,23 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn,
>> >>
>> >> BUG_ON(atomic_read(&mm->mm_users) <= 0);
>> >>
>> >> - ret = -ENOMEM;
>> >> - mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), GFP_KERNEL);
>> >> - if (unlikely(!mmu_notifier_mm))
>> >> - goto out;
>> >> -
>> >> if (take_mmap_sem)
>> >> down_write(&mm->mmap_sem);
>> >> ret = mm_take_all_locks(mm);
>> >> if (unlikely(ret))
>> >> - goto out_cleanup;
>> >> + goto out;
>> >>
>> >> if (!mm_has_notifiers(mm)) {
>> >> + mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm),
>> >> + GFP_ATOMIC);
>> >
>> >Why was the code switched to the far weaker GFP_ATOMIC? We can still
>> >perform sleeping allocations inside mmap_sem.
>> >
>>
>> Yes, we can perform sleeping while allocating memory, but we're holding
>> the "mmap_sem". GFP_KERNEL possiblly block somebody else who also waits
>> on mmap_sem for long time even though the case should be rare :-)
>
>GFP_ATOMIC allocations are unreliable. If the allocation attempt fails
>here, an entire kernel subsystem will have failed, quite probably
>requiring a reboot. It's a bad tradeoff.
>
Yep. Thanks, Andrew :-)
>Please fix this and retest. With lockdep enabled, of course.
>
>And please do not attempt to sneak changes like this into the kernel
>without even mentioning them in the changelog. If I hadn't have
>happened to notice this, we'd have ended up with a less reliable
>kernel.
>
I'll fix and rerest it.
Thanks,
Gavin
--
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:[~2012-08-31 1:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 14:37 [PATCH 1/2] mm/mmu_notifier: init notifier if necessary Wanpeng Li
2012-08-24 14:37 ` Wanpeng Li
2012-08-24 14:37 ` [PATCH 2/2] mm/vmscan: fix error number for failed kthread Wanpeng Li
2012-08-24 14:37 ` Wanpeng Li
2012-08-24 21:51 ` [PATCH 1/2] mm/mmu_notifier: init notifier if necessary Andrew Morton
2012-08-24 21:51 ` Andrew Morton
2012-08-25 9:47 ` Gavin Shan
2012-08-25 9:47 ` Gavin Shan
[not found] ` <50389f4d.0793b60a.1627.7710SMTPIN_ADDED@mx.google.com>
2012-08-30 19:13 ` Andrew Morton
2012-08-30 19:13 ` Andrew Morton
2012-08-31 1:07 ` Gavin Shan [this message]
2012-08-31 1:07 ` Gavin Shan
-- strict thread matches above, loose matches on Subject: below --
2012-08-24 14:37 Wanpeng Li
2012-08-24 14:37 ` Wanpeng Li
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='20120831010701.GA5026@shangw.(null)' \
--to=shangw@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liwanp@linux.vnet.ibm.com \
--cc=mhocko@suse.cz \
--cc=minchan@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.