From: Martin Maletinsky <maletinsky@scs.ch>
To: Benjamin LaHaise <bcrl@redhat.com>
Cc: kernelnewbies@nl.linux.org, linux-mm@kvack.org
Subject: Re: Slab allocator - questions
Date: Thu, 04 Apr 2002 08:19:08 +0200 [thread overview]
Message-ID: <3CABF05C.4EA66796@scs.ch> (raw)
In-Reply-To: <20020403143227.A6301@redhat.com>
Hello,
> ...
> > 2) Why are there general caches up to a size of 128K byte? Since a slab
> > consists of physically contiguous pages, one might call right into the
> > buddy system to get chunks of memory that are a multiple of a page size.
> > What is the benefit of allocating memory chunks that are a multiple of
> > a page size by using kmalloc()/kmem_cache_alloc() rather than
> > get_free_pages?
>
> Memory fragmentation. By grouping objects of the same type and similar
> lifetimes, slab helps prevent the pinning of many individual pages across
> the system. Since slab allocations cannot be relocated, this helps when
> other allocations need to obtain non-0 order pages.
Thank you for your reply. Could you detail how memory fragmentation is reduced? I understand the assumption that objects of the same type (and therefore same size) tend to
have similar lifetimes. However the general caches for objects that are a multiple of a page size contain one object per cache (see /proc/slabinfo). Each time such an
object is allocated by kmalloc(), the slab allocator will therefore use a new slab (which is allocated by calling into the buddy system). So what is the difference with
respect to memory fragmentation compared to calling straight the buddy system by using get_free_pages()?
regards
Martin
--
Supercomputing System AG email: maletinsky@scs.ch
Martin Maletinsky phone: +41 (0)1 445 16 05
Technoparkstrasse 1 fax: +41 (0)1 445 16 10
CH-8005 Zurich
--
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/
next prev parent reply other threads:[~2002-04-04 6:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-03 8:59 Martin Maletinsky
2002-04-03 19:32 ` Benjamin LaHaise
2002-04-04 6:19 ` Martin Maletinsky [this message]
2002-04-04 22:30 ` Benjamin LaHaise
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=3CABF05C.4EA66796@scs.ch \
--to=maletinsky@scs.ch \
--cc=bcrl@redhat.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-mm@kvack.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox