Re: kmalloc without GFP_xxx?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 29 2005, Denis Vlasenko wrote:
> On Wednesday 29 June 2005 14:15, Jens Axboe wrote:
> > On Wed, Jun 29 2005, Denis Vlasenko wrote:
> > > So why can't we have kmalloc_auto(size) which does GFP_KERNEL alloc
> > > if called from non-atomic context and GFP_ATOMIC one otherwise?
> > 
> > Because it's a lot better in generel if we force people to think about
> > what they are doing wrt memory allocations. You should know if you are
> > able to block or not, a lot of functions exported require you to have
> > this knowledge anyways. Adding these auto-detection type functions
> > encourages bad programming, imho.
> 
> Those 'bad programming' people can simply use GFP_ATOMIC always, no?
> This would be even worse because kmalloc_auto() will sleep
> if it's allowed, but GFP_ATOMIC would not.

Sure, you can't stop people from doing bad programming. But I don't
think we should aid them along the way.

-- 
Jens Axboe

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux