* [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
@ 2008-12-10 17:36 Catalin Marinas
2008-12-10 19:34 ` Cyrill Gorcunov
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Catalin Marinas @ 2008-12-10 17:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Matt Mackall
It looks like the kmem_cache_create() function in the slob allocator
passes the SLAB flags as GFP flags to the slob_alloc() function. The
patch changes this call to pass GFP_KERNEL as the other allocators seem
to do.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Matt Mackall <mpm@selenic.com>
---
mm/slob.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mm/slob.c b/mm/slob.c
index ff5a98d..dce9258 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -538,7 +538,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
struct kmem_cache *c;
c = slob_alloc(sizeof(struct kmem_cache),
- flags, ARCH_KMALLOC_MINALIGN, -1);
+ GFP_KERNEL, ARCH_KMALLOC_MINALIGN, -1);
if (c) {
c->name = name;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 17:36 [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create Catalin Marinas
@ 2008-12-10 19:34 ` Cyrill Gorcunov
2008-12-10 19:57 ` Matt Mackall
2008-12-10 20:11 ` Christoph Lameter
2008-12-10 19:58 ` Matt Mackall
2008-12-11 9:31 ` Pekka Enberg
2 siblings, 2 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2008-12-10 19:34 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-kernel, Matt Mackall, Pekka Enberg, Christoph Lameter
[Catalin Marinas - Wed, Dec 10, 2008 at 05:36:33PM +0000]
| It looks like the kmem_cache_create() function in the slob allocator
| passes the SLAB flags as GFP flags to the slob_alloc() function. The
| patch changes this call to pass GFP_KERNEL as the other allocators seem
| to do.
|
| Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| Cc: Matt Mackall <mpm@selenic.com>
| ---
| mm/slob.c | 2 +-
| 1 files changed, 1 insertions(+), 1 deletions(-)
|
| diff --git a/mm/slob.c b/mm/slob.c
| index ff5a98d..dce9258 100644
| --- a/mm/slob.c
| +++ b/mm/slob.c
| @@ -538,7 +538,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
| struct kmem_cache *c;
|
| c = slob_alloc(sizeof(struct kmem_cache),
| - flags, ARCH_KMALLOC_MINALIGN, -1);
| + GFP_KERNEL, ARCH_KMALLOC_MINALIGN, -1);
|
| if (c) {
| c->name = name;
|
Hi Catalin,
this would make the following line in slob_alloc
...
if (unlikely((gfp & __GFP_ZERO) && b))
memset(b, 0, size);
...
useless. Not sure if it will be good :)
---
Some CC: added
- Cyrill -
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 19:34 ` Cyrill Gorcunov
@ 2008-12-10 19:57 ` Matt Mackall
2008-12-10 20:06 ` Cyrill Gorcunov
2008-12-10 20:11 ` Christoph Lameter
1 sibling, 1 reply; 8+ messages in thread
From: Matt Mackall @ 2008-12-10 19:57 UTC (permalink / raw)
To: Cyrill Gorcunov
Cc: Catalin Marinas, linux-kernel, Pekka Enberg, Christoph Lameter
On Wed, 2008-12-10 at 22:34 +0300, Cyrill Gorcunov wrote:
> [Catalin Marinas - Wed, Dec 10, 2008 at 05:36:33PM +0000]
> | It looks like the kmem_cache_create() function in the slob allocator
> | passes the SLAB flags as GFP flags to the slob_alloc() function. The
> | patch changes this call to pass GFP_KERNEL as the other allocators seem
> | to do.
> |
> | Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> | Cc: Matt Mackall <mpm@selenic.com>
> | ---
> | mm/slob.c | 2 +-
> | 1 files changed, 1 insertions(+), 1 deletions(-)
> |
> | diff --git a/mm/slob.c b/mm/slob.c
> | index ff5a98d..dce9258 100644
> | --- a/mm/slob.c
> | +++ b/mm/slob.c
> | @@ -538,7 +538,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
> | struct kmem_cache *c;
> |
> | c = slob_alloc(sizeof(struct kmem_cache),
> | - flags, ARCH_KMALLOC_MINALIGN, -1);
> | + GFP_KERNEL, ARCH_KMALLOC_MINALIGN, -1);
> |
> | if (c) {
> | c->name = name;
> |
>
> Hi Catalin,
>
> this would make the following line in slob_alloc
>
> ...
> if (unlikely((gfp & __GFP_ZERO) && b))
> memset(b, 0, size);
> ...
>
> useless. Not sure if it will be good :)
I think that's fine. Notice that this is not the allocation of an
object, but the allocation of a cache descriptor. We save the flags
inside the descriptor so that when the user calls kmem_cache_alloc, we
can pass them along to slob_alloc, where GFP_ZERO can take effect.
So, if we're comfortable with the idea that we can only create caches in
'normal' contexts, then I think the patch is fine.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 17:36 [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create Catalin Marinas
2008-12-10 19:34 ` Cyrill Gorcunov
@ 2008-12-10 19:58 ` Matt Mackall
2008-12-11 9:31 ` Pekka Enberg
2 siblings, 0 replies; 8+ messages in thread
From: Matt Mackall @ 2008-12-10 19:58 UTC (permalink / raw)
To: Catalin Marinas; +Cc: linux-kernel
On Wed, 2008-12-10 at 17:36 +0000, Catalin Marinas wrote:
> It looks like the kmem_cache_create() function in the slob allocator
> passes the SLAB flags as GFP flags to the slob_alloc() function. The
> patch changes this call to pass GFP_KERNEL as the other allocators seem
> to do.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Matt Mackall <mpm@selenic.com>
Good catch.
Acked-by: Matt Mackall <mpm@selenic.com>
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 19:57 ` Matt Mackall
@ 2008-12-10 20:06 ` Cyrill Gorcunov
0 siblings, 0 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2008-12-10 20:06 UTC (permalink / raw)
To: Matt Mackall
Cc: Catalin Marinas, linux-kernel, Pekka Enberg, Christoph Lameter
[Matt Mackall - Wed, Dec 10, 2008 at 01:57:50PM -0600]
...
| I think that's fine. Notice that this is not the allocation of an
| object, but the allocation of a cache descriptor. We save the flags
| inside the descriptor so that when the user calls kmem_cache_alloc, we
| can pass them along to slob_alloc, where GFP_ZERO can take effect.
|
| So, if we're comfortable with the idea that we can only create caches in
| 'normal' contexts, then I think the patch is fine.
|
| --
| Mathematics is the supreme nostalgia of our time.
|
Yes Matt, somehow missed that.
- Cyrill -
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 19:34 ` Cyrill Gorcunov
2008-12-10 19:57 ` Matt Mackall
@ 2008-12-10 20:11 ` Christoph Lameter
2008-12-10 20:23 ` Cyrill Gorcunov
1 sibling, 1 reply; 8+ messages in thread
From: Christoph Lameter @ 2008-12-10 20:11 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: Catalin Marinas, linux-kernel, Matt Mackall, Pekka Enberg
On Wed, 10 Dec 2008, Cyrill Gorcunov wrote:
> this would make the following line in slob_alloc
>
> ...
> if (unlikely((gfp & __GFP_ZERO) && b))
> memset(b, 0, size);
> ...
>
> useless. Not sure if it will be good :)
No. GFP_ZERO is set when kmalloc etc is called. Its not set on
kmem_cache_create.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 20:11 ` Christoph Lameter
@ 2008-12-10 20:23 ` Cyrill Gorcunov
0 siblings, 0 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2008-12-10 20:23 UTC (permalink / raw)
To: Christoph Lameter
Cc: Catalin Marinas, linux-kernel, Matt Mackall, Pekka Enberg
[Christoph Lameter - Wed, Dec 10, 2008 at 02:11:23PM -0600]
| On Wed, 10 Dec 2008, Cyrill Gorcunov wrote:
|
| > this would make the following line in slob_alloc
| >
| > ...
| > if (unlikely((gfp & __GFP_ZERO) && b))
| > memset(b, 0, size);
| > ...
| >
| > useless. Not sure if it will be good :)
|
| No. GFP_ZERO is set when kmalloc etc is called. Its not set on
| kmem_cache_create.
|
yep, Matt already pointed, I just missed first time.
- Cyrill -
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create
2008-12-10 17:36 [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create Catalin Marinas
2008-12-10 19:34 ` Cyrill Gorcunov
2008-12-10 19:58 ` Matt Mackall
@ 2008-12-11 9:31 ` Pekka Enberg
2 siblings, 0 replies; 8+ messages in thread
From: Pekka Enberg @ 2008-12-11 9:31 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-kernel, Matt Mackall, Cyrill Gorcunov, Christoph Lameter
On Wed, Dec 10, 2008 at 7:36 PM, Catalin Marinas
<catalin.marinas@arm.com> wrote:
> It looks like the kmem_cache_create() function in the slob allocator
> passes the SLAB flags as GFP flags to the slob_alloc() function. The
> patch changes this call to pass GFP_KERNEL as the other allocators seem
> to do.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Matt Mackall <mpm@selenic.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-12-11 9:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 17:36 [PATCH] Do not pass the SLAB flags as GFP in slob kmem_cache_create Catalin Marinas
2008-12-10 19:34 ` Cyrill Gorcunov
2008-12-10 19:57 ` Matt Mackall
2008-12-10 20:06 ` Cyrill Gorcunov
2008-12-10 20:11 ` Christoph Lameter
2008-12-10 20:23 ` Cyrill Gorcunov
2008-12-10 19:58 ` Matt Mackall
2008-12-11 9:31 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox