All of lore.kernel.org
 help / color / mirror / Atom feed
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg KH <greg@kroah.com>,
	gregkh@suse.de, devel@driverdev.osuosl.org,
	dan.magenheimer@oracle.com, cascardo@holoscopio.com,
	linux-kernel@vger.kernel.org, dave@linux.vnet.ibm.com,
	linux-mm@kvack.org, brking@linux.vnet.ibm.com,
	rcj@linux.vnet.ibm.com
Subject: Re: [PATCH v2 0/3] staging: zcache: xcfmalloc support
Date: Mon, 12 Sep 2011 09:35:50 -0500	[thread overview]
Message-ID: <4E6E18C6.8080900@linux.vnet.ibm.com> (raw)
In-Reply-To: <4E6ACE5B.9040401@vflare.org>

On 09/09/2011 09:41 PM, Nitin Gupta wrote:
> On 09/09/2011 04:34 PM, Greg KH wrote:
> 
>> On Wed, Sep 07, 2011 at 09:09:04AM -0500, Seth Jennings wrote:
>>> Changelog:
>>> v2: fix bug in find_remove_block()
>>>     fix whitespace warning at EOF
>>>
>>> This patchset introduces a new memory allocator for persistent
>>> pages for zcache.  The current allocator is xvmalloc.  xvmalloc
>>> has two notable limitations:
>>> * High (up to 50%) external fragmentation on allocation sets > PAGE_SIZE/2
>>> * No compaction support which reduces page reclaimation
>>
>> I need some acks from other zcache developers before I can accept this.
>>
> 
> First, thanks for this new allocator; xvmalloc badly needed a replacement :)
> 

Hey Nitin, I hope your internship went well :)  It's good to hear from you.

> I went through xcfmalloc in detail and would be posting detailed
> comments tomorrow.  In general, it seems to be quite similar to the
> "chunk based" allocator used in initial implementation of "compcache" --
> please see section 2.3.1 in this paper:
> http://www.linuxsymposium.org/archives/OLS/Reprints-2007/briglia-Reprint.pdf
> 

Ah, indeed they look similar.  I didn't know that this approach
had already been done before in the history of this project.

> I'm really looking forward to a slab based allocator as I mentioned in
> the initial mail:
> http://permalink.gmane.org/gmane.linux.kernel.mm/65467
> 
> With the current design xcfmalloc suffers from issues similar to the
> allocator described in the paper:
>  - High metadata overhead
>  - Difficult implementation of compaction
>  - Need for extra memcpy()s  etc.
> 
> With slab based approach, we can almost eliminate any metadata overhead,
> remove any free chunk merging logic, simplify compaction and so on.
> 

Just to align my understanding with yours, when I hear slab-based,
I'm thinking each page in the compressed memory pool will contain
1 or more blocks that are all the same size.  Is this what you mean?

If so, I'm not sure how changing to a slab-based system would eliminate
metadata overhead or do away with memcpy()s.

The memcpy()s are a side effect of having an allocation spread over
blocks in different pages.  I'm not seeing a way around this.

It also follows that the blocks that make up an allocation must be in
a list of some kind, leading to some amount of metadata overhead.

If you want to do compaction, it follows that you can't give the user
a direct pointer to the data, since the location of that data may change.
In this case, an indirection layer is required (i.e. xcf_blkdesc and
xcf_read()/xcf_write()).

The only part of the metadata that could be done away with in a slab-
based approach, as far as I can see, is the prevoffset field in xcf_blkhdr,
since the size of the previous block in the page (or the previous object
in the slab) can be inferred from the size of the current block/object.

I do agree that we don't have to worry about free block merging in a
slab-based system.

I didn't implement compaction so a slab-based system could very well
make it easier.  I guess it depends on how one ends up doing it.

Anyway, I look forward to your detailed comments :)

--
Seth


WARNING: multiple messages have this Message-ID (diff)
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg KH <greg@kroah.com>,
	gregkh@suse.de, devel@driverdev.osuosl.org,
	dan.magenheimer@oracle.com, cascardo@holoscopio.com,
	linux-kernel@vger.kernel.org, dave@linux.vnet.ibm.com,
	linux-mm@kvack.org, brking@linux.vnet.ibm.com,
	rcj@linux.vnet.ibm.com
Subject: Re: [PATCH v2 0/3] staging: zcache: xcfmalloc support
Date: Mon, 12 Sep 2011 09:35:50 -0500	[thread overview]
Message-ID: <4E6E18C6.8080900@linux.vnet.ibm.com> (raw)
In-Reply-To: <4E6ACE5B.9040401@vflare.org>

On 09/09/2011 09:41 PM, Nitin Gupta wrote:
> On 09/09/2011 04:34 PM, Greg KH wrote:
> 
>> On Wed, Sep 07, 2011 at 09:09:04AM -0500, Seth Jennings wrote:
>>> Changelog:
>>> v2: fix bug in find_remove_block()
>>>     fix whitespace warning at EOF
>>>
>>> This patchset introduces a new memory allocator for persistent
>>> pages for zcache.  The current allocator is xvmalloc.  xvmalloc
>>> has two notable limitations:
>>> * High (up to 50%) external fragmentation on allocation sets > PAGE_SIZE/2
>>> * No compaction support which reduces page reclaimation
>>
>> I need some acks from other zcache developers before I can accept this.
>>
> 
> First, thanks for this new allocator; xvmalloc badly needed a replacement :)
> 

Hey Nitin, I hope your internship went well :)  It's good to hear from you.

> I went through xcfmalloc in detail and would be posting detailed
> comments tomorrow.  In general, it seems to be quite similar to the
> "chunk based" allocator used in initial implementation of "compcache" --
> please see section 2.3.1 in this paper:
> http://www.linuxsymposium.org/archives/OLS/Reprints-2007/briglia-Reprint.pdf
> 

Ah, indeed they look similar.  I didn't know that this approach
had already been done before in the history of this project.

> I'm really looking forward to a slab based allocator as I mentioned in
> the initial mail:
> http://permalink.gmane.org/gmane.linux.kernel.mm/65467
> 
> With the current design xcfmalloc suffers from issues similar to the
> allocator described in the paper:
>  - High metadata overhead
>  - Difficult implementation of compaction
>  - Need for extra memcpy()s  etc.
> 
> With slab based approach, we can almost eliminate any metadata overhead,
> remove any free chunk merging logic, simplify compaction and so on.
> 

Just to align my understanding with yours, when I hear slab-based,
I'm thinking each page in the compressed memory pool will contain
1 or more blocks that are all the same size.  Is this what you mean?

If so, I'm not sure how changing to a slab-based system would eliminate
metadata overhead or do away with memcpy()s.

The memcpy()s are a side effect of having an allocation spread over
blocks in different pages.  I'm not seeing a way around this.

It also follows that the blocks that make up an allocation must be in
a list of some kind, leading to some amount of metadata overhead.

If you want to do compaction, it follows that you can't give the user
a direct pointer to the data, since the location of that data may change.
In this case, an indirection layer is required (i.e. xcf_blkdesc and
xcf_read()/xcf_write()).

The only part of the metadata that could be done away with in a slab-
based approach, as far as I can see, is the prevoffset field in xcf_blkhdr,
since the size of the previous block in the page (or the previous object
in the slab) can be inferred from the size of the current block/object.

I do agree that we don't have to worry about free block merging in a
slab-based system.

I didn't implement compaction so a slab-based system could very well
make it easier.  I guess it depends on how one ends up doing it.

Anyway, I look forward to your detailed comments :)

--
Seth

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-09-12 14:39 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 14:09 [PATCH v2 0/3] staging: zcache: xcfmalloc support Seth Jennings
2011-09-07 14:09 ` Seth Jennings
2011-09-07 14:09 ` [PATCH v2 1/3] staging: zcache: xcfmalloc memory allocator for zcache Seth Jennings
2011-09-07 14:09   ` Seth Jennings
2011-09-07 14:09 ` [PATCH v2 2/3] staging: zcache: replace xvmalloc with xcfmalloc Seth Jennings
2011-09-07 14:09   ` Seth Jennings
2011-09-07 14:09 ` [PATCH v2 3/3] staging: zcache: add zv_page_count and zv_desc_count Seth Jennings
2011-09-07 14:09   ` Seth Jennings
2011-09-09 20:34 ` [PATCH v2 0/3] staging: zcache: xcfmalloc support Greg KH
2011-09-09 20:34   ` Greg KH
2011-09-10  2:41   ` Nitin Gupta
2011-09-10  2:41     ` Nitin Gupta
2011-09-12 14:35     ` Seth Jennings [this message]
2011-09-12 14:35       ` Seth Jennings
2011-09-13  1:55       ` Nitin Gupta
2011-09-13  1:55         ` Nitin Gupta
2011-09-13 15:58         ` Seth Jennings
2011-09-13 15:58           ` Seth Jennings
2011-09-13 21:18           ` Nitin Gupta
2011-09-13 21:18             ` Nitin Gupta
2011-09-15 16:31             ` Seth Jennings
2011-09-15 16:31               ` Seth Jennings
2011-09-15 17:29               ` Dan Magenheimer
2011-09-15 17:29                 ` Dan Magenheimer
2011-09-15 19:24                 ` Seth Jennings
2011-09-15 19:24                   ` Seth Jennings
2011-09-15 20:07                   ` Dan Magenheimer
2011-09-15 20:07                     ` Dan Magenheimer
2011-10-03 15:59                     ` Dave Hansen
2011-10-03 15:59                       ` Dave Hansen
2011-10-03 17:54                       ` Nitin Gupta
2011-10-03 17:54                         ` Nitin Gupta
2011-10-03 18:22                         ` Dave Hansen
2011-10-03 18:22                           ` Dave Hansen
2011-10-05  1:03                           ` Dan Magenheimer
2011-10-05  1:03                             ` Dan Magenheimer
2011-09-15 22:17                   ` Dave Hansen
2011-09-15 22:17                     ` Dave Hansen
2011-09-15 22:27                     ` Dan Magenheimer
2011-09-15 22:27                       ` Dan Magenheimer
2011-09-16 17:36                     ` Nitin Gupta
2011-09-16 17:36                       ` Nitin Gupta
2011-09-16 17:52                   ` Nitin Gupta
2011-09-16 17:52                     ` Nitin Gupta
2011-09-16 17:46               ` Nitin Gupta
2011-09-16 17:46                 ` Nitin Gupta
2011-09-16 18:33                 ` Seth Jennings
2011-09-16 18:33                   ` Seth Jennings
2011-11-01 17:30                 ` Dave Hansen
2011-11-01 17:30                   ` Dave Hansen
2011-11-01 18:35                   ` Dan Magenheimer
2011-11-01 18:35                     ` Dan Magenheimer
2011-11-02  2:42                     ` Nitin Gupta
2011-11-02  2:42                       ` Nitin Gupta
2011-09-29 17:47 ` Seth Jennings
2011-09-29 17:47   ` Seth Jennings

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=4E6E18C6.8080900@linux.vnet.ibm.com \
    --to=sjenning@linux.vnet.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=cascardo@holoscopio.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=rcj@linux.vnet.ibm.com \
    /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.