From: Giridhar Pemmasani <giri@lmc.cs.sunysb.edu>
To: Andi Kleen <ak@suse.de>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>, linux-kernel@vger.kernel.org
Subject: Re: __vmalloc with GFP_ATOMIC causes 'sleeping from invalid context'
Date: Mon, 22 May 2006 11:12:58 -0400 [thread overview]
Message-ID: <20060522151258.F1259EE9EE@wolfe.lmc.cs.sunysb.edu> (raw)
In-Reply-To: <p73fyj271fp.fsf@verdi.suse.de>
On 22 May 2006 13:18:18 +0200, Andi Kleen <ak@suse.de> said:
> Nick Piggin <nickpiggin@yahoo.com.au> writes:
>> Giridhar Pemmasani wrote: > If __vmalloc is called in atomic
>> context with GFP_ATOMIC flags, > __get_vm_area_node is called,
>> which calls kmalloc_node with GFP_KERNEL > flags. This causes
>> 'sleeping function called from invalid context at >
>> mm/slab.c:2729' with 2.6.16-rc4 kernel. A simple solution is to
>> use
>>
>> I can't see what would cause this in either 2.6.16-rc4 or
>> 2.6.17-rc4. What is the line?
>>
>> > proper flags in __get_vm_area_node, depending on the context:
>>
>> I don't think that always works, you might pass in GFP_ATOMIC due
>> to having hold of a spinlock, for example.
>>
>> Also, vmlist_lock isn't interrupt safe, so it still kind of goes
>> against the spirit of GFP_ATOMIC (which is to allow allocation
>> from interrupt context).
> That's not the only problem. Allocating page table entries or
> flushing TLBs from an atomic context is just not supported by the
> low level architecture code.
I looked through __vmalloc implementation and the call tree. Nowhere
do I see a problem with calling __vmalloc in atomic context (with
GFP_ATOMIC flags, of course). Except for a few architectures (arm,
m68k, sparc and xtensa), flusch_cache_all is a nop. I didn't look into
all architectures, but at least for m68k, flush_cache_all seems to
safe in atomic context. Please correct me if I am wrong.
To reiterate, __get_vm_area_node allocates space for 'struct
vm_struct' with GFP_KERNEL irrespective of how its caller was called -
if __vmalloc was called with GFP_ATOMIC, the node for that allocation
should be allocated with the same flags. So the patch I suggested
simply passes the flags from __vmalloc down to __get_vm_area_node.
If indeed it is not safe to call __vmalloc in atomic context (even
with GFP_ATOMIC flags), perhaps we can add BUG_ON(in_atomic()) to
__vmalloc?
Thanks,
Giri
next prev parent reply other threads:[~2006-05-22 15:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-22 1:36 Giridhar Pemmasani
2006-05-22 1:51 ` Arjan van de Ven
2006-05-22 6:01 ` Giridhar Pemmasani
2006-05-22 1:53 ` Nick Piggin
2006-05-22 5:58 ` Giridhar Pemmasani
2006-05-22 6:07 ` Nick Piggin
2006-05-22 6:10 ` Nick Piggin
2006-05-22 6:14 ` Nick Piggin
2006-05-22 7:08 ` Giridhar Pemmasani
2006-05-22 7:34 ` Nick Piggin
2006-05-22 14:55 ` Giridhar Pemmasani
2006-05-22 6:56 ` Giridhar Pemmasani
2006-05-22 21:56 ` Andrew Morton
2006-05-22 22:59 ` Giridhar Pemmasani
2006-05-22 11:18 ` Andi Kleen
2006-05-22 15:12 ` Giridhar Pemmasani [this message]
2006-05-22 11:47 ` Alan Cox
2006-10-23 6:13 Giridhar Pemmasani
2006-10-23 10:38 ` Alan Cox
2006-10-23 11:11 ` Giridhar Pemmasani
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=20060522151258.F1259EE9EE@wolfe.lmc.cs.sunysb.edu \
--to=giri@lmc.cs.sunysb.edu \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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
all inboxes | Powered by JetHome®