Re: Q: semaphore and kmalloc(GFP_KERNEL)?

From: KOSAKI Motohiro
Date: Sun May 10 2009 - 23:21:55 EST


> KOSAKI Motohiro wrote:
> > > Can the kernel detect that we need to let kmalloc() fail and
> > > wake up the writer process so that the writer process releases
> > > the rw_semaphore and reader processes can continue?
> >
> > it can't. Plus it shouldn't.
> > some caller don't want kmalloc() failure.
>
> Thanks.
> Then, should I move kmalloc(GFP_KERNEL) to outside the lock whenever possible?

Yes. almost driver does it.
this is generic issue of nested locking.

> (I worry some lock held by the caller interferes kmalloc(GFP_KERNEL).)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/