Re: [PATCHv5 1/8] zsmalloc: add to mm/
From: Seth Jennings
Date: Mon Feb 18 2013 - 14:04:30 EST
On 02/15/2013 09:26 PM, Ric Mason wrote:
> On 02/14/2013 02:38 AM, Seth Jennings wrote:
>> =========
>> DO NOT MERGE, FOR REVIEW ONLY
>> This patch introduces zsmalloc as new code, however, it already
>> exists in drivers/staging. In order to build successfully, you
>> must select EITHER to driver/staging version OR this version.
>> Once zsmalloc is reviewed in this format (and hopefully accepted),
>> I will create a new patchset that properly promotes zsmalloc from
>> staging.
>> =========
>>
>> This patchset introduces a new slab-based memory allocator,
>> zsmalloc, for storing compressed pages. It is designed for
>> low fragmentation and high allocation success rate on
>> large object, but <= PAGE_SIZE allocations.
>>
>> zsmalloc differs from the kernel slab allocator in two primary
>> ways to achieve these design goals.
>>
>> zsmalloc never requires high order page allocations to back
>> slabs, or "size classes" in zsmalloc terms. Instead it allows
>> multiple single-order pages to be stitched together into a
>> "zspage" which backs the slab. This allows for higher allocation
>> success rate under memory pressure.
>>
>> Also, zsmalloc allows objects to span page boundaries within the
>> zspage. This allows for lower fragmentation than could be had
>> with the kernel slab allocator for objects between PAGE_SIZE/2
>> and PAGE_SIZE. With the kernel slab allocator, if a page compresses
>> to 60% of it original size, the memory savings gained through
>> compression is lost in fragmentation because another object of
>> the same size can't be stored in the leftover space.
>
> Why you say so? slab/slub allocator both have policies to setup
> suitable order of pages in each slab cache in order to reduce
> fragmentation. Which codes show you slab object can't span page
> boundaries? Could you pointed out to me?
I might need to reword this. What I meant to say is "non-contiguous
page boundaries".
zsmalloc allows an object to span non-contiguous page boundaries
within a zspage. This obviously can't be done by slab/slub since they
give addresses directly to users and the object data must be
contiguous. This is one reason why zsmalloc allocations require
mapping to obtain a usable address.
Thanks,
Seth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/