Re: [patch v2 1/5] mm: add nofail variants of kmalloc kcalloc and kzalloc

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Rientjes
Date: Sunday, September 5, 2010 - 4:01 pm

On Thu, 2 Sep 2010, Jiri Slaby wrote:


It actually does work as I expect since the WARN_ON_ONCE() never even gets 
triggered here for any of kmalloc_nofail()'s callers since they all have 
sizes small enough that the conditional is never true.  The page allocator 
implicitly loops forever if the order <= PAGE_ALLOC_COSTLY_ORDER, so this 
warning is only emitted if the #define implementation of the page 
allocator only changes.  That's intended, we want to know the consequences 
of our change.


No, it didn't, it was unnecessary for all of the kmalloc_nofail() callers 
since they already implicitly loop.  No warning is emitted (these are all 
GFP_NOFS or GFP_NOIO users, there are no order-4 or larger GFP_ATOMIC 
allocators using this interface).


Couple reasons:

 - it's unnecessary in the page allocator, it can be implemented at a 
   higher level, which allows us to remove these branches from the 
   slowpath,

 - it's mostly unnecessary since all users have orders that will 
   implicitly loop forever anyway (although __GFP_NOFAIL does guarantee 
   that it won't fail even if we change the looping behavior internally,
   these warnings help to isolate cases where it's needed), and
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2/5] mm: add nofail variant of kmem_cache_zalloc, David Rientjes, (Tue Aug 24, 3:50 am)
[patch 3/5] fs: add nofail variant of alloc_buffer_head, David Rientjes, (Tue Aug 24, 3:50 am)
[patch 4/5] btrfs: add nofail variant of set_extent_dirty, David Rientjes, (Tue Aug 24, 3:50 am)
[patch 5/5] ntfs: remove dependency on __GFP_NOFAIL, David Rientjes, (Tue Aug 24, 3:50 am)
Re: [patch 1/5] mm: add nofail variants of kmalloc kcalloc ..., Christoph Lameter, (Wed Aug 25, 2:11 pm)
Re: [patch 1/5] mm: add nofail variants of kmalloc kcalloc ..., Christoph Lameter, (Wed Aug 25, 2:35 pm)
Re: [patch 1/5] mm: add nofail variants of kmalloc kcalloc ..., Christoph Lameter, (Wed Aug 25, 6:30 pm)
Re: [patch 1/5] mm: add nofail variants of kmalloc kcalloc ..., Christoph Lameter, (Thu Aug 26, 7:16 am)
[patch v2 5/5] ntfs: remove dependency on __GFP_NOFAIL, David Rientjes, (Wed Sep 1, 6:03 pm)
Re: [patch v2 5/5] ntfs: remove dependency on __GFP_NOFAIL, Anton Altaparmakov, (Thu Sep 2, 2:08 am)
Re: [patch v2 1/5] mm: add nofail variants of kmalloc kcal ..., David Rientjes, (Sun Sep 5, 4:01 pm)