linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [question] how to increase the number of object on cache?
@ 2012-08-02 12:20 Shawn Joo
  2012-08-02 12:50 ` Glauber Costa
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shawn Joo @ 2012-08-02 12:20 UTC (permalink / raw)
  To: cl, penberg, mpm; +Cc: linux-mm

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

Dear Experts,

I would like to know a mechanism, how to increase the number of object and where the memory is from.

(because when cache is created by "kmem_cache_create", there is only object size, but no number of the object)
For example, "size-65536" does not have available memory from below dump.
In that state, if memory allocation is requested to "size-65536",

1.     How to allocate/increase the number of object on "size-65536"?

2.     Where is the new allocated memory from? (from buddy?)

I believe it is hard to explain with simple word, any advice will be very helpful.

cat /proc/buddyinfo
Node 0, zone   Normal    949      0      0      2      3      3      0      0      1      1      0

cat /proc/slabinfo
slabinfo - version: 2.1
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>
size-4194304           0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0
size-2097152           0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0
size-1048576           0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0
size-524288            0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0
size-262144            0      0 262144    1   64 : tunables    1    1    0 : slabdata      0      0      0
size-131072            1      1 131072    1   32 : tunables    8    4    0 : slabdata      1      1      0
size-65536             4      4  65536    1   16 : tunables    8    4    0 : slabdata      4      4      0




Thanks,
Seongho(Shawn)


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

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

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

* Re: [question] how to increase the number of object on cache?
  2012-08-02 12:20 [question] how to increase the number of object on cache? Shawn Joo
@ 2012-08-02 12:50 ` Glauber Costa
  2012-08-02 12:55   ` Shawn Joo
  2012-08-02 13:50 ` Michal Hocko
  2012-08-02 13:54 ` Christoph Lameter
  2 siblings, 1 reply; 6+ messages in thread
From: Glauber Costa @ 2012-08-02 12:50 UTC (permalink / raw)
  To: Shawn Joo; +Cc: cl, penberg, mpm, linux-mm

On 08/02/2012 04:20 PM, Shawn Joo wrote:
> Dear Experts,
> 
>  
> 
> I would like to know a mechanism, how to increase the number of object
> and where the memory is from.
> 
> (because when cache is created by "kmem_cache_create", there is only
> object size, but no number of the object)
> 
> For example, “size-65536” does not have available memory from below dump.
> 
> In that state, if memory allocation is requested to “size-65536”,
> 
> 1.     How to allocate/increase the number of object on “size-65536”?
> 
> 2.     Where is the new allocated memory from? (from buddy?)
> 
>  

I am not sure I fully understand your question. But if you refer to
something like "from where does the object allocators get their memory
when more is needed", then yes, they will allocate the necessary number
of pages from the standard page allocator.

--
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: [question] how to increase the number of object on cache?
  2012-08-02 12:50 ` Glauber Costa
@ 2012-08-02 12:55   ` Shawn Joo
  2012-08-02 13:02     ` Glauber Costa
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Joo @ 2012-08-02 12:55 UTC (permalink / raw)
  To: Glauber Costa; +Cc: cl, penberg, mpm, linux-mm

>> then yes, they will allocate the necessary number of pages from the standard page allocator.
Who is "the standard page allocator" for cache in /proc/slabinfo, e.g. "size-65536" ?
I believe one of allocator is buddy. who else?

Thanks,
Seongho(Shawn)


-----Original Message-----
From: Glauber Costa [mailto:glommer@parallels.com] 
Sent: Thursday, August 02, 2012 9:51 PM
To: Shawn Joo
Cc: cl@linux-foundation.org; penberg@kernel.org; mpm@selenic.com; linux-mm@kvack.org
Subject: Re: [question] how to increase the number of object on cache?

On 08/02/2012 04:20 PM, Shawn Joo wrote:
> Dear Experts,
> 
>  
> 
> I would like to know a mechanism, how to increase the number of object 
> and where the memory is from.
> 
> (because when cache is created by "kmem_cache_create", there is only 
> object size, but no number of the object)
> 
> For example, "size-65536" does not have available memory from below dump.
> 
> In that state, if memory allocation is requested to "size-65536",
> 
> 1.     How to allocate/increase the number of object on "size-65536"?
> 
> 2.     Where is the new allocated memory from? (from buddy?)
> 
>  

I am not sure I fully understand your question. But if you refer to something like "from where does the object allocators get their memory when more is needed", then yes, they will allocate the necessary number of pages from the standard page allocator.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

--
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: [question] how to increase the number of object on cache?
  2012-08-02 12:55   ` Shawn Joo
@ 2012-08-02 13:02     ` Glauber Costa
  0 siblings, 0 replies; 6+ messages in thread
From: Glauber Costa @ 2012-08-02 13:02 UTC (permalink / raw)
  To: Shawn Joo; +Cc: cl, penberg, mpm, linux-mm

On 08/02/2012 04:55 PM, Shawn Joo wrote:
>>> then yes, they will allocate the necessary number of pages from the standard page allocator.
> Who is "the standard page allocator" for cache in /proc/slabinfo, e.g. "size-65536" ?
> I believe one of allocator is buddy. who else?
> 
The generic and algorithm-neutral answer to this is "whoever would
handle alloc_pages()".
In the specific case, yes, this is the buddy allocator.

Take a look at mm/slab.c, for instance:

When a cache can't service an allocation, it does:

  cache_grow()
  -> kmem_getpages()
    -> alloc_pages_exact_node()


--
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: [question] how to increase the number of object on cache?
  2012-08-02 12:20 [question] how to increase the number of object on cache? Shawn Joo
  2012-08-02 12:50 ` Glauber Costa
@ 2012-08-02 13:50 ` Michal Hocko
  2012-08-02 13:54 ` Christoph Lameter
  2 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2012-08-02 13:50 UTC (permalink / raw)
  To: Shawn Joo; +Cc: cl, penberg, mpm, linux-mm

On Thu 02-08-12 20:20:25, Shawn Joo wrote:
> Dear Experts,
> 
> I would like to know a mechanism, how to increase the number of object and where the memory is from.
> 
> (because when cache is created by "kmem_cache_create", there is only object size, but no number of the object)
> For example, "size-65536" does not have available memory from below dump.
> In that state, if memory allocation is requested to "size-65536",

Is this a follow up for
http://www.spinics.net/lists/linux-mm/msg39252.html? It would be better
to follow the thread in that case.

> 1.     How to allocate/increase the number of object on "size-65536"?

Object count is increased automatically and transparently for the cache
users. Why would you want to control its size from the outside?

> 2.     Where is the new allocated memory from? (from buddy?)

page allocator when it cannot find any room in the internally available
space. Have a look at [1] if you want to learn more about the slab
allocator (the code has changed since then but the princibles are still
valid).

[1] http://kernel.org/doc/gorman/html/understand/understand011.html

-- 
Michal Hocko
SUSE Labs

--
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: [question] how to increase the number of object on cache?
  2012-08-02 12:20 [question] how to increase the number of object on cache? Shawn Joo
  2012-08-02 12:50 ` Glauber Costa
  2012-08-02 13:50 ` Michal Hocko
@ 2012-08-02 13:54 ` Christoph Lameter
  2 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2012-08-02 13:54 UTC (permalink / raw)
  To: Shawn Joo; +Cc: penberg, mpm, linux-mm, Michal Hocko

On Thu, 2 Aug 2012, Shawn Joo wrote:

> 1.     How to allocate/increase the number of object on "size-65536"?

I would suggest to use the page allocator directly for large allocations
like this. The slab allocators specialize in cutting 4k pages up in
smaller units and serving those units effectively.

> 2.     Where is the new allocated memory from? (from buddy?)

Ultimately yes but the slab allocators may have their own caching layer on
top given the slow as molasses page allocator. The caching effect is
excellent for small objects but not for large objects such as yours.

--
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:[~2012-08-02 13:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02 12:20 [question] how to increase the number of object on cache? Shawn Joo
2012-08-02 12:50 ` Glauber Costa
2012-08-02 12:55   ` Shawn Joo
2012-08-02 13:02     ` Glauber Costa
2012-08-02 13:50 ` Michal Hocko
2012-08-02 13:54 ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox