[0/5] staging: zsmalloc: memory allocator for compressed pages
mbox series

Message ID 1326149520-31720-1-git-send-email-sjenning@linux.vnet.ibm.com
Headers show
Series
  • staging: zsmalloc: memory allocator for compressed pages
Related show

Message

Seth Jennings Jan. 9, 2012, 10:51 p.m. UTC
This patchset introduces a new memory allocation library named
zsmalloc.  zsmalloc was designed to fulfill the needs
of users where:
 1) Memory is constrained, preventing contiguous page allocations
    larger than order 0 and
 2) Allocations are all/commonly greater than half a page.

In a generic allocator, an allocation set like this would
cause high fragmentation.  The allocations can't span non-
contiguous page boundaries; therefore, the part of the page
unused by each allocation is wasted.

zsmalloc is a slab-based allocator that uses a non-standard
malloc interface, requiring the user to map the allocation
before accessing it. This allows allocations to span two
non-contiguous pages using virtual memory mapping, greatly
reducing fragmentation in the memory pool.

Nitin Gupta (3):
  staging: zsmalloc: zsmalloc memory allocation library
  staging: zram: replace xvmalloc with zsmalloc
  staging: zram: remove xvmalloc

Seth Jennings (2):
  staging: add zsmalloc to Kconfig/Makefile
  staging: zcache: replace xvmalloc with zsmalloc

 drivers/staging/Kconfig                  |    2 +
 drivers/staging/Makefile                 |    2 +-
 drivers/staging/zcache/Kconfig           |    2 +-
 drivers/staging/zcache/zcache-main.c     |   83 ++--
 drivers/staging/zram/Kconfig             |    6 +-
 drivers/staging/zram/Makefile            |    1 -
 drivers/staging/zram/xvmalloc.c          |  510 --------------------
 drivers/staging/zram/xvmalloc.h          |   30 --
 drivers/staging/zram/xvmalloc_int.h      |   95 ----
 drivers/staging/zram/zram_drv.c          |   89 ++--
 drivers/staging/zram/zram_drv.h          |   10 +-
 drivers/staging/zram/zram_sysfs.c        |    2 +-
 drivers/staging/zsmalloc/Kconfig         |   11 +
 drivers/staging/zsmalloc/Makefile        |    3 +
 drivers/staging/zsmalloc/zsmalloc-main.c |  756 ++++++++++++++++++++++++++++++
 drivers/staging/zsmalloc/zsmalloc.h      |   31 ++
 drivers/staging/zsmalloc/zsmalloc_int.h  |  126 +++++
 17 files changed, 1020 insertions(+), 739 deletions(-)
 delete mode 100644 drivers/staging/zram/xvmalloc.c
 delete mode 100644 drivers/staging/zram/xvmalloc.h
 delete mode 100644 drivers/staging/zram/xvmalloc_int.h
 create mode 100644 drivers/staging/zsmalloc/Kconfig
 create mode 100644 drivers/staging/zsmalloc/Makefile
 create mode 100644 drivers/staging/zsmalloc/zsmalloc-main.c
 create mode 100644 drivers/staging/zsmalloc/zsmalloc.h
 create mode 100644 drivers/staging/zsmalloc/zsmalloc_int.h

Comments

Greg KH Jan. 9, 2012, 11:09 p.m. UTC | #1
On Mon, Jan 09, 2012 at 04:51:55PM -0600, Seth Jennings wrote:
> This patchset introduces a new memory allocation library named
> zsmalloc.  zsmalloc was designed to fulfill the needs
> of users where:
>  1) Memory is constrained, preventing contiguous page allocations
>     larger than order 0 and
>  2) Allocations are all/commonly greater than half a page.

As this is submitted during the merge window, I don't have any time to
look at it until after 3.3-rc1 is out.

I'll queue it up for then.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Seth Jennings Jan. 9, 2012, 11:26 p.m. UTC | #2
On 01/09/2012 05:09 PM, Greg KH wrote:
> On Mon, Jan 09, 2012 at 04:51:55PM -0600, Seth Jennings wrote:
>> This patchset introduces a new memory allocation library named
>> zsmalloc.  zsmalloc was designed to fulfill the needs
>> of users where:
>>  1) Memory is constrained, preventing contiguous page allocations
>>     larger than order 0 and
>>  2) Allocations are all/commonly greater than half a page.
> 
> As this is submitted during the merge window, I don't have any time to
> look at it until after 3.3-rc1 is out.
> 
> I'll queue it up for then.

Thanks Greg!

I forgot to specify in the cover letter, this patch is based on
v3.2 PLUS my zv stat fix (https://lkml.org/lkml/2011/12/30/48) 
and crypto API support patch v2 (https://lkml.org/lkml/2012/1/3/263).
Both have been Acked by Dan and Nitin had Acked v1 of the crypto API
support patch. Everything should merge cleanly if applied in that
order.

--
Seth

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Andrew Morton Jan. 20, 2012, 10:03 p.m. UTC | #3
On Mon,  9 Jan 2012 16:51:55 -0600
Seth Jennings <sjenning@linux.vnet.ibm.com> wrote:

> This patchset introduces a new memory allocation library named
> zsmalloc.  zsmalloc was designed to fulfill the needs
> of users where:
>  1) Memory is constrained, preventing contiguous page allocations
>     larger than order 0 and
>  2) Allocations are all/commonly greater than half a page.
> 
> In a generic allocator, an allocation set like this would
> cause high fragmentation.  The allocations can't span non-
> contiguous page boundaries; therefore, the part of the page
> unused by each allocation is wasted.
> 
> zsmalloc is a slab-based allocator that uses a non-standard
> malloc interface, requiring the user to map the allocation
> before accessing it. This allows allocations to span two
> non-contiguous pages using virtual memory mapping, greatly
> reducing fragmentation in the memory pool.

The changelog doesn't really describe why the code was written and
provides no reason for anyone to merge it.

Perhaps the reason was to clean up and generalise the zram xvmalloc
code.  Perhaps the reason was also to then use zsmalloc somewhere else
in the kernel.  But I really don't know.  This is the most important
part of the patch description and you completely omitted it!


Where will this code live after it escapes from drivers/staging/? mm/?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Seth Jennings Jan. 23, 2012, 2:27 p.m. UTC | #4
Hey Andrew,

Thanks for the feedback.

On 01/20/2012 04:03 PM, Andrew Morton wrote:
> On Mon,  9 Jan 2012 16:51:55 -0600
> Seth Jennings <sjenning@linux.vnet.ibm.com> wrote:
> 
> The changelog doesn't really describe why the code was written and
> provides no reason for anyone to merge it. <snip>  This is the most important
> part of the patch description and you completely omitted it!

Sorry about that.  The purpose is to replace the xvmalloc allocator
that both zcache and zram use that suffers from the high fragmentation
described.  I 'll be sure to add this to the cover letter.

I was thinking it would go to lib after staging.

Thanks,
--
Seth

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/