All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
@ 2015-01-07  2:01 Bryton Lee
  2015-01-07  3:16   ` Christoph Lameter
  0 siblings, 1 reply; 6+ messages in thread
From: Bryton Lee @ 2015-01-07  2:01 UTC (permalink / raw)
  To: iamjoonsoo.kim
  Cc: cl, penberg, rientjes, akpm, linux-mm, linux-kernel,
	vger.linux-kernel.cn

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME from file mm/slab_common.c
to file linux/slab.h.
let other kernel code create slab can use these flags.

Signed-off-by: Bryton Lee <brytonlee01@gmail.com>
---
 include/linux/slab.h | 11 +++++++++++
 mm/slab_common.c     | 10 ----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 9a139b6..6853f85 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -90,6 +90,17 @@
 /* The following flags affect the page allocator grouping pages by
mobility */
 #define SLAB_RECLAIM_ACCOUNT    0x00020000UL        /* Objects are
reclaimable */
 #define SLAB_TEMPORARY        SLAB_RECLAIM_ACCOUNT    /* Objects are
short-lived */
+
+/*
+ * Set of flags that will prevent slab merging
+ */
+#define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
+        SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \
+        SLAB_FAILSLAB)
+
+#define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
+        SLAB_CACHE_DMA | SLAB_NOTRACK)
+
 /*
  * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
  *
diff --git a/mm/slab_common.c b/mm/slab_common.c
index e03dd6f..4f1974b 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -31,16 +31,6 @@ DEFINE_MUTEX(slab_mutex);
 struct kmem_cache *kmem_cache;

 /*
- * Set of flags that will prevent slab merging
- */
-#define SLAB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
-        SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \
-        SLAB_FAILSLAB)
-
-#define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
-        SLAB_CACHE_DMA | SLAB_NOTRACK)
-
-/*
  * Merge control. If this is set then no merging of slab caches will occur.
  * (Could be removed. This was introduced to pacify the merge skeptics.)
  */
-- 
2.0.5



-- 
Best Regards

Bryton.Lee

[-- Attachment #2: Type: text/html, Size: 2287 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
  2015-01-07  2:01 [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h Bryton Lee
@ 2015-01-07  3:16   ` Christoph Lameter
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2015-01-07  3:16 UTC (permalink / raw)
  To: Bryton Lee
  Cc: iamjoonsoo.kim, penberg, rientjes, akpm, linux-mm, linux-kernel,
	vger.linux-kernel.cn

On Wed, 7 Jan 2015, Bryton Lee wrote:

> move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME from file mm/slab_common.c
> to file linux/slab.h.
> let other kernel code create slab can use these flags.

This does not make sense. The fact that a slab has been merged is
available from a field in the kmem_cache structure (aliases).


These two macros are criteria for the slab allocators to perform merges.
The merge decision is the slab allocators decision and not the decision of
other kernel code.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
@ 2015-01-07  3:16   ` Christoph Lameter
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2015-01-07  3:16 UTC (permalink / raw)
  To: Bryton Lee
  Cc: iamjoonsoo.kim, penberg, rientjes, akpm, linux-mm, linux-kernel,
	vger.linux-kernel.cn

On Wed, 7 Jan 2015, Bryton Lee wrote:

> move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME from file mm/slab_common.c
> to file linux/slab.h.
> let other kernel code create slab can use these flags.

This does not make sense. The fact that a slab has been merged is
available from a field in the kmem_cache structure (aliases).


These two macros are criteria for the slab allocators to perform merges.
The merge decision is the slab allocators decision and not the decision of
other kernel code.


--
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] 6+ messages in thread

* Re: [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
  2015-01-07  3:16   ` Christoph Lameter
  (?)
@ 2015-01-07  7:32   ` Bryton Lee
  2015-01-21 22:44       ` David Rientjes
  -1 siblings, 1 reply; 6+ messages in thread
From: Bryton Lee @ 2015-01-07  7:32 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: iamjoonsoo.kim, penberg, rientjes, akpm, linux-mm, linux-kernel,
	vger.linux-kernel.cn

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

thanks for review my patch.

I want to move these macros to linux/slab.h cause I don't want perform
merge in slab level.   for example. ss read /proc/slabinfo to finger out
how many requests pending in the TCP listern queue.  it  use slabe name
"tcp_timewait_sock_ops" search in /proc/slabinfo, although the name is
obsolete. so I committed other patch  to iproute2, replaced
tcp_timewait_sock_ops by request_sock_TCP, but it still not work, because
slab request_sock_TCP  merge into kmalloc-256.

how could I prevent this merge happen.  I'm new to kernel, this is my first
time submit a kernel patch, thanks!


On Wed, Jan 7, 2015 at 11:16 AM, Christoph Lameter <cl@linux.com> wrote:

> On Wed, 7 Jan 2015, Bryton Lee wrote:
>
> > move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME from file
> mm/slab_common.c
> > to file linux/slab.h.
> > let other kernel code create slab can use these flags.
>
> This does not make sense. The fact that a slab has been merged is
> available from a field in the kmem_cache structure (aliases).
>
>
> These two macros are criteria for the slab allocators to perform merges.
> The merge decision is the slab allocators decision and not the decision of
> other kernel code.
>
>
>


-- 
Best Regards

Bryton.Lee

[-- Attachment #2: Type: text/html, Size: 1748 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
  2015-01-07  7:32   ` Bryton Lee
@ 2015-01-21 22:44       ` David Rientjes
  0 siblings, 0 replies; 6+ messages in thread
From: David Rientjes @ 2015-01-21 22:44 UTC (permalink / raw)
  To: Bryton Lee
  Cc: Christoph Lameter, iamjoonsoo.kim, penberg, Andrew Morton,
	linux-mm, linux-kernel

On Wed, 7 Jan 2015, Bryton Lee wrote:

> thanks for review my patch.
> 
> I want to move these macros to linux/slab.h cause I don't want perform
> merge in slab level.   for example. ss read /proc/slabinfo to finger out
> how many requests pending in the TCP listern queue.  it  use slabe name
> "tcp_timewait_sock_ops" search in /proc/slabinfo, although the name is
> obsolete. so I committed other patch  to iproute2, replaced
> tcp_timewait_sock_ops by request_sock_TCP, but it still not work, because
> slab request_sock_TCP  merge into kmalloc-256.
> 
> how could I prevent this merge happen.  I'm new to kernel, this is my first
> time submit a kernel patch, thanks!
> 

Any bit in SLAB_NEVER_MERGE will cause the allocator to not merge the slab 
caches, it's not necessary to all of them be set as it seems you're 
implying.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h
@ 2015-01-21 22:44       ` David Rientjes
  0 siblings, 0 replies; 6+ messages in thread
From: David Rientjes @ 2015-01-21 22:44 UTC (permalink / raw)
  To: Bryton Lee
  Cc: Christoph Lameter, iamjoonsoo.kim, penberg, Andrew Morton,
	linux-mm, linux-kernel

On Wed, 7 Jan 2015, Bryton Lee wrote:

> thanks for review my patch.
> 
> I want to move these macros to linux/slab.h cause I don't want perform
> merge in slab level.   for example. ss read /proc/slabinfo to finger out
> how many requests pending in the TCP listern queue.  it  use slabe name
> "tcp_timewait_sock_ops" search in /proc/slabinfo, although the name is
> obsolete. so I committed other patch  to iproute2, replaced
> tcp_timewait_sock_ops by request_sock_TCP, but it still not work, because
> slab request_sock_TCP  merge into kmalloc-256.
> 
> how could I prevent this merge happen.  I'm new to kernel, this is my first
> time submit a kernel patch, thanks!
> 

Any bit in SLAB_NEVER_MERGE will cause the allocator to not merge the slab 
caches, it's not necessary to all of them be set as it seems you're 
implying.

--
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] 6+ messages in thread

end of thread, other threads:[~2015-01-21 22:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07  2:01 [PATCH] mm: move MACRO SLAB_NEVER_MERGE and SLAB_MERGE_SAME to file linux/slab.h Bryton Lee
2015-01-07  3:16 ` Christoph Lameter
2015-01-07  3:16   ` Christoph Lameter
2015-01-07  7:32   ` Bryton Lee
2015-01-21 22:44     ` David Rientjes
2015-01-21 22:44       ` David Rientjes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.