All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <aystarik@gmail.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-acpi@vger.kernel.org, lenb@kernel.org
Subject: Re: [patch][rfc] acpi: do not use kmem caches
Date: Mon, 01 Dec 2008 20:04:21 +0300	[thread overview]
Message-ID: <49341915.5000900@gmail.com> (raw)
In-Reply-To: <20081201162018.GF10790@wotan.suse.de>

Nick Piggin wrote:
> On Mon, Dec 01, 2008 at 05:48:05PM +0300, Alexey Starikovskiy wrote:
>   
>> Christoph Lameter wrote:
>>     
>>> On Mon, 1 Dec 2008, Pekka Enberg wrote:
>>>
>>>  
>>>       
>>>> Why do you think Nick's patch is going to _increase_ memory consumption?
>>>> SLUB _already_ merges the ACPI caches with kmalloc caches so you won't
>>>> see any difference there. For SLAB, it's a gain because there's not
>>>> enough activity going on which results in lots of unused space in the
>>>> slabs (which is, btw, the reason SLUB does slab merging in the first
>>>> place).
>>>>    
>>>>         
>>> The patch is going to increase memory consumption because the use of
>>> the kmalloc array means that the allocated object sizes are rounded up to
>>> the next power of two.
>>>
>>> I would recommend to keep the caches. Subsystem specific caches help to
>>> simplify debugging and track the memory allocated for various purposes in
>>> addition to saving the rounding up to power of two overhead.
>>> And with SLUB the creation of such caches usually does not require
>>> additional memory.
>>>
>>> Maybe it would be best to avoid kmalloc as much as possible.
>>>
>>>  
>>>       
>> Christoph,
>> Thanks for support, these were my thoughts, when I changed ACPICA to use 
>> kmem_cache instead of
>> it's own on top of kmalloc 4 years ago...
>> Here are two acpi caches on my thinkpad z61m, IMHO any laptop will show 
>> similar numbers:
>>
>> aystarik@thinkpad:~$ cat /proc/slabinfo | grep Acpi
>> Acpi-ParseExt       2856   2856     72   56    1 : tunables    0    0    
>> 0 : slabdata     51     51      0
>> Acpi-Parse           170    170     48   85    1 : tunables    0    0    
>> 0 : slabdata      2      2      0
>>
>> Size of first will become 96 and size of second will be 64 if kmalloc is 
>> used, and we don't count ACPICA internal overhead.
>> Number of used blocks is not smallest in the list of slabs, actually it 
>> is among the highest.
>>     
>
> Hmm.
> Acpi-Operand        2641   2773     64   59    1 : tunables  120   60    8 : slabdata     47     47     0
> Acpi-ParseExt          0      0     64   59    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-Parse             0      0     40   92    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-State             0      0     80   48    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-Namespace      1711   1792     32  112    1 : tunables  120   60    8 : slabdata     16     16     0
>
>   
> Looks different for my thinkpad.
>   
Probably this is SLUB vs. SLAB thing Pecca was talking about...
And, probably you run at 32-bit? This is part of my .config:
--------------------------------------------
CONFIG_SLUB_DEBUG=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
-------------------------------------------

With your patch you would be able to save 64*(2773 - 2641) + 32 * 
(1792-1711)= 8448 + 2592 = 11040 bytes of memory, less than 3 pages?

2856 * (96-72) = 68544 bytes and 170 * (64-48) = 2720 bytes, so you will be wasting 5 times more memory in 64 bit case.




WARNING: multiple messages have this Message-ID (diff)
From: Alexey Starikovskiy <aystarik@gmail.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Linux Memory Management List <linux-mm@kvack.org>,
	linux-acpi@vger.kernel.org, lenb@kernel.org
Subject: Re: [patch][rfc] acpi: do not use kmem caches
Date: Mon, 01 Dec 2008 20:04:21 +0300	[thread overview]
Message-ID: <49341915.5000900@gmail.com> (raw)
In-Reply-To: <20081201162018.GF10790@wotan.suse.de>

Nick Piggin wrote:
> On Mon, Dec 01, 2008 at 05:48:05PM +0300, Alexey Starikovskiy wrote:
>   
>> Christoph Lameter wrote:
>>     
>>> On Mon, 1 Dec 2008, Pekka Enberg wrote:
>>>
>>>  
>>>       
>>>> Why do you think Nick's patch is going to _increase_ memory consumption?
>>>> SLUB _already_ merges the ACPI caches with kmalloc caches so you won't
>>>> see any difference there. For SLAB, it's a gain because there's not
>>>> enough activity going on which results in lots of unused space in the
>>>> slabs (which is, btw, the reason SLUB does slab merging in the first
>>>> place).
>>>>    
>>>>         
>>> The patch is going to increase memory consumption because the use of
>>> the kmalloc array means that the allocated object sizes are rounded up to
>>> the next power of two.
>>>
>>> I would recommend to keep the caches. Subsystem specific caches help to
>>> simplify debugging and track the memory allocated for various purposes in
>>> addition to saving the rounding up to power of two overhead.
>>> And with SLUB the creation of such caches usually does not require
>>> additional memory.
>>>
>>> Maybe it would be best to avoid kmalloc as much as possible.
>>>
>>>  
>>>       
>> Christoph,
>> Thanks for support, these were my thoughts, when I changed ACPICA to use 
>> kmem_cache instead of
>> it's own on top of kmalloc 4 years ago...
>> Here are two acpi caches on my thinkpad z61m, IMHO any laptop will show 
>> similar numbers:
>>
>> aystarik@thinkpad:~$ cat /proc/slabinfo | grep Acpi
>> Acpi-ParseExt       2856   2856     72   56    1 : tunables    0    0    
>> 0 : slabdata     51     51      0
>> Acpi-Parse           170    170     48   85    1 : tunables    0    0    
>> 0 : slabdata      2      2      0
>>
>> Size of first will become 96 and size of second will be 64 if kmalloc is 
>> used, and we don't count ACPICA internal overhead.
>> Number of used blocks is not smallest in the list of slabs, actually it 
>> is among the highest.
>>     
>
> Hmm.
> Acpi-Operand        2641   2773     64   59    1 : tunables  120   60    8 : slabdata     47     47     0
> Acpi-ParseExt          0      0     64   59    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-Parse             0      0     40   92    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-State             0      0     80   48    1 : tunables  120   60    8 : slabdata      0      0     0
> Acpi-Namespace      1711   1792     32  112    1 : tunables  120   60    8 : slabdata     16     16     0
>
>   
> Looks different for my thinkpad.
>   
Probably this is SLUB vs. SLAB thing Pecca was talking about...
And, probably you run at 32-bit? This is part of my .config:
--------------------------------------------
CONFIG_SLUB_DEBUG=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
-------------------------------------------

With your patch you would be able to save 64*(2773 - 2641) + 32 * 
(1792-1711)= 8448 + 2592 = 11040 bytes of memory, less than 3 pages?

2856 * (96-72) = 68544 bytes and 170 * (64-48) = 2720 bytes, so you will be wasting 5 times more memory in 64 bit case.



--
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>

  reply	other threads:[~2008-12-01 17:04 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01  8:31 [patch][rfc] acpi: do not use kmem caches Nick Piggin
2008-12-01  8:31 ` Nick Piggin
2008-12-01 11:18 ` Pekka Enberg
2008-12-01 11:18   ` Pekka Enberg
2008-12-01 12:00   ` Nick Piggin
2008-12-01 12:00     ` Nick Piggin
2008-12-01 13:12     ` Alexey Starikovskiy
2008-12-01 13:12       ` Alexey Starikovskiy
2008-12-01 13:36       ` Nick Piggin
2008-12-01 13:36         ` Nick Piggin
2008-12-01 14:14         ` Alexey Starikovskiy
2008-12-01 14:14           ` Alexey Starikovskiy
2008-12-01 16:32           ` Nick Piggin
2008-12-01 16:32             ` Nick Piggin
2008-12-01 17:18           ` Christoph Hellwig
2008-12-01 17:18             ` Christoph Hellwig
2008-12-01 17:32             ` Alexey Starikovskiy
2008-12-01 17:32               ` Alexey Starikovskiy
2008-12-01 13:37       ` Pekka Enberg
2008-12-01 13:37         ` Pekka Enberg
2008-12-01 14:02         ` Alexey Starikovskiy
2008-12-01 14:02           ` Alexey Starikovskiy
2008-12-01 16:14           ` Nick Piggin
2008-12-01 16:14             ` Nick Piggin
2008-12-01 16:45             ` Alexey Starikovskiy
2008-12-01 16:45               ` Alexey Starikovskiy
2008-12-01 16:58               ` Nick Piggin
2008-12-01 16:58                 ` Nick Piggin
2008-12-01 17:20               ` Moore, Robert
2008-12-01 17:20                 ` Moore, Robert
2008-12-01 17:30                 ` Andi Kleen
2008-12-01 17:30                   ` Andi Kleen
2008-12-01 17:32                   ` Moore, Robert
2008-12-01 17:32                     ` Moore, Robert
2008-12-01 17:20               ` Christoph Hellwig
2008-12-01 17:20                 ` Christoph Hellwig
2008-12-01 17:49                 ` Alexey Starikovskiy
2008-12-01 17:49                   ` Alexey Starikovskiy
2008-12-01 17:53                 ` Len Brown
2008-12-01 17:53                   ` Len Brown
2008-12-01 18:10                   ` Nick Piggin
2008-12-01 18:10                     ` Nick Piggin
2008-12-31 22:04                     ` Len Brown
2008-12-31 22:04                       ` Len Brown
2009-01-05  4:14                       ` Nick Piggin
2009-01-05  4:14                         ` Nick Piggin
2009-01-05  5:43                         ` Skywing
2009-01-05  6:55                           ` Nick Piggin
2009-01-05  6:55                             ` Nick Piggin
2008-12-01 14:32         ` Christoph Lameter
2008-12-01 14:32           ` Christoph Lameter
2008-12-01 14:48           ` Alexey Starikovskiy
2008-12-01 14:48             ` Alexey Starikovskiy
2008-12-01 16:20             ` Nick Piggin
2008-12-01 16:20               ` Nick Piggin
2008-12-01 17:04               ` Alexey Starikovskiy [this message]
2008-12-01 17:04                 ` Alexey Starikovskiy
2008-12-01 17:12                 ` Nick Piggin
2008-12-01 17:12                   ` Nick Piggin
2008-12-01 17:25                   ` Pekka Enberg
2008-12-01 17:25                     ` Pekka Enberg
2008-12-01 17:32                     ` Pekka Enberg
2008-12-01 17:32                       ` Pekka Enberg
2008-12-01 17:36                       ` Alexey Starikovskiy
2008-12-01 17:36                         ` Alexey Starikovskiy
2008-12-01 17:48                         ` Pekka Enberg
2008-12-01 18:09                         ` Christoph Lameter
2008-12-01 18:09                           ` Christoph Lameter
2008-12-01 17:43                   ` Alexey Starikovskiy
2008-12-01 17:43                     ` Alexey Starikovskiy
2008-12-01 17:31 ` Len Brown
2008-12-01 17:31   ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49341915.5000900@gmail.com \
    --to=aystarik@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.