* [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
@ 2014-11-10 12:06 Andrey Ryabinin
2014-11-19 23:46 ` David Rientjes
0 siblings, 1 reply; 7+ messages in thread
From: Andrey Ryabinin @ 2014-11-10 12:06 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel, Andrey Ryabinin, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg, David Rientjes
kmem_cache_zalloc_node() allocates zeroed memory for a particular
cache from a specified memory node. To be used for struct irq_desc.
Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
---
include/linux/slab.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index c265bec..b3248fa 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -574,6 +574,12 @@ static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags)
return kmem_cache_alloc(k, flags | __GFP_ZERO);
}
+static inline void *kmem_cache_zalloc_node(struct kmem_cache *k, gfp_t flags,
+ int node)
+{
+ return kmem_cache_alloc_node(k, flags | __GFP_ZERO, node);
+}
+
/**
* kzalloc - allocate memory. The memory is set to zero.
* @size: how many bytes of memory are required.
--
2.1.3
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-10 12:06 [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node() Andrey Ryabinin
@ 2014-11-19 23:46 ` David Rientjes
2014-11-20 8:47 ` Andrey Ryabinin
0 siblings, 1 reply; 7+ messages in thread
From: David Rientjes @ 2014-11-19 23:46 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Thomas Gleixner, linux-kernel, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg
On Mon, 10 Nov 2014, Andrey Ryabinin wrote:
> kmem_cache_zalloc_node() allocates zeroed memory for a particular
> cache from a specified memory node. To be used for struct irq_desc.
>
Is there a reason to add this for such a specialized purpose to the slab
allocator? I think it can just be handled for struct irq_desc explicitly.
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-19 23:46 ` David Rientjes
@ 2014-11-20 8:47 ` Andrey Ryabinin
2014-11-20 20:03 ` Christoph Lameter
2014-11-20 22:31 ` David Rientjes
0 siblings, 2 replies; 7+ messages in thread
From: Andrey Ryabinin @ 2014-11-20 8:47 UTC (permalink / raw)
To: David Rientjes
Cc: Thomas Gleixner, linux-kernel, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg
On 11/20/2014 02:46 AM, David Rientjes wrote:
> On Mon, 10 Nov 2014, Andrey Ryabinin wrote:
>
>> kmem_cache_zalloc_node() allocates zeroed memory for a particular
>> cache from a specified memory node. To be used for struct irq_desc.
>>
>
> Is there a reason to add this for such a specialized purpose to the slab
> allocator? I think it can just be handled for struct irq_desc explicitly.
>
It could be used not only for irq_desc. Grepping sources gave me 7 possible users.
We already have zeroing variants of kmalloc/kmalloc_node/kmem_cache_alloc,
so why kmem_cache_alloc_node is special?
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-20 8:47 ` Andrey Ryabinin
@ 2014-11-20 20:03 ` Christoph Lameter
2014-11-20 22:31 ` David Rientjes
1 sibling, 0 replies; 7+ messages in thread
From: Christoph Lameter @ 2014-11-20 20:03 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: David Rientjes, Thomas Gleixner, linux-kernel, Andrew Morton,
linux-mm, Pekka Enberg
On Thu, 20 Nov 2014, Andrey Ryabinin wrote:
> It could be used not only for irq_desc. Grepping sources gave me 7 possible users.
>
> We already have zeroing variants of kmalloc/kmalloc_node/kmem_cache_alloc,
> so why kmem_cache_alloc_node is special?
Why do we need this at all? You can always add the __GFP_ZERO flag and any
alloc function will then zero the memory for you.
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-20 8:47 ` Andrey Ryabinin
2014-11-20 20:03 ` Christoph Lameter
@ 2014-11-20 22:31 ` David Rientjes
2014-11-21 6:29 ` Andrey Ryabinin
1 sibling, 1 reply; 7+ messages in thread
From: David Rientjes @ 2014-11-20 22:31 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Thomas Gleixner, linux-kernel, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg
On Thu, 20 Nov 2014, Andrey Ryabinin wrote:
> > Is there a reason to add this for such a specialized purpose to the slab
> > allocator? I think it can just be handled for struct irq_desc explicitly.
> >
>
> It could be used not only for irq_desc. Grepping sources gave me 7 possible users.
>
It would be best to follow in the example of those users and just use
__GFP_ZERO.
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-20 22:31 ` David Rientjes
@ 2014-11-21 6:29 ` Andrey Ryabinin
2014-11-21 9:57 ` David Rientjes
0 siblings, 1 reply; 7+ messages in thread
From: Andrey Ryabinin @ 2014-11-21 6:29 UTC (permalink / raw)
To: David Rientjes
Cc: Thomas Gleixner, linux-kernel, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg
On 11/21/2014 01:31 AM, David Rientjes wrote:
> On Thu, 20 Nov 2014, Andrey Ryabinin wrote:
>
>>> Is there a reason to add this for such a specialized purpose to the slab
>>> allocator? I think it can just be handled for struct irq_desc explicitly.
>>>
>>
>> It could be used not only for irq_desc. Grepping sources gave me 7 possible users.
>>
>
> It would be best to follow in the example of those users and just use
> __GFP_ZERO.
>
Fair enough.
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node()
2014-11-21 6:29 ` Andrey Ryabinin
@ 2014-11-21 9:57 ` David Rientjes
0 siblings, 0 replies; 7+ messages in thread
From: David Rientjes @ 2014-11-21 9:57 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Thomas Gleixner, linux-kernel, Christoph Lameter, Andrew Morton,
linux-mm, Pekka Enberg
On Fri, 21 Nov 2014, Andrey Ryabinin wrote:
> On 11/21/2014 01:31 AM, David Rientjes wrote:
> > On Thu, 20 Nov 2014, Andrey Ryabinin wrote:
> >
> >>> Is there a reason to add this for such a specialized purpose to the slab
> >>> allocator? I think it can just be handled for struct irq_desc explicitly.
> >>>
> >>
> >> It could be used not only for irq_desc. Grepping sources gave me 7 possible users.
> >>
> >
> > It would be best to follow in the example of those users and just use
> > __GFP_ZERO.
> >
>
> Fair enough.
>
Thanks, and feel free to add my
Acked-by: David Rientjes <rientjes@google.com.
on the other two patches once they are refreshed.
--
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-11-21 9:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-10 12:06 [PATCH 1/3] mm: sl[aou]b: introduce kmem_cache_zalloc_node() Andrey Ryabinin
2014-11-19 23:46 ` David Rientjes
2014-11-20 8:47 ` Andrey Ryabinin
2014-11-20 20:03 ` Christoph Lameter
2014-11-20 22:31 ` David Rientjes
2014-11-21 6:29 ` Andrey Ryabinin
2014-11-21 9:57 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox