From: Seth Jennings <sjennings@variantweb.net>
To: Dan Streetman <ddstreet@ieee.org>
Cc: Minchan Kim <minchan@kernel.org>,
Weijie Yang <weijie.yang@samsung.com>,
Nitin Gupta <ngupta@vflare.org>,
Andrew Morton <akpm@linux-foundation.org>,
Bob Liu <bob.liu@oracle.com>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Linux-MM <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv3 3/6] mm/zpool: implement common zpool api to zbud/zsmalloc
Date: Wed, 28 May 2014 22:48:35 -0500 [thread overview]
Message-ID: <20140529034835.GA18063@cerebellum.variantweb.net> (raw)
In-Reply-To: <CALZtONBp+ckT222fcXQgGOx4AgNBLA7D6ZOKB4Zg_RqX1do0vw@mail.gmail.com>
On Tue, May 27, 2014 at 08:06:28PM -0400, Dan Streetman wrote:
> On Tue, May 27, 2014 at 6:06 PM, Seth Jennings <sjennings@variantweb.net> wrote:
> > On Sat, May 24, 2014 at 03:06:06PM -0400, Dan Streetman wrote:
<snip>
> >> + * Returns: 0 on success, negative value on error/failure.
> >> + */
> >> +int zpool_shrink(struct zpool *pool, size_t size);
> >
> > This should take a number of pages to be reclaimed, not a size. The
> > user can evict their own object to reclaim a certain number of bytes
> > from the pool. What the user can't do is reclaim a page since it is not
> > aware of the arrangement of the stored objects in the memory pages.
>
> Yes I suppose that's true, I'll update it for v4...
>
> >
> > Also in patch 5/6 of six I see:
> >
> > - if (zbud_reclaim_page(zswap_pool, 8)) {
> > + if (zpool_shrink(zswap_pool, PAGE_SIZE)) {
> >
> > but then in 4/6 I see:
> >
> > +int zbud_zpool_shrink(void *pool, size_t size)
> > +{
> > + return zbud_reclaim_page(pool, 8);
> > +}
> >
> > That is why it didn't completely explode on you since the zbud logic
> > is still reclaiming pages.
>
> Ha, yes clearly I neglected to translate between the size and the
> number of pages there, oops!
>
> On this topic - 8 retries seems very arbitrary. Does it make sense to
> include retrying in zbud and/or zpool at all? The caller can easily
> retry any number of times themselves, especially since zbud (and
> eventually zsmalloc) will return -EAGAIN if the caller should retry.
Yeah, the retries argument in the zbud API isn't good. You can change
the zbud_reclaim_page() to just try once and return -EAGAIN if you want
and I'll be in favor of that.
That did make me think of something else though. The zpool API is
zpool_shrink() with, what will be, a number of pages. The zbud API is
zbud_reclaim_page() which, as the name implies, reclaims one page. So
it seems that you would need a loop in zbud_zpool_shrink() to try to
reclaim a multiple number of pages.
>
> >
> >> +
> >> +/**
> >> + * zpool_map_handle() - Map a previously allocated handle into memory
> >> + * @pool The zpool that the handle was allocated from
> >> + * @handle The handle to map
> >> + * @mm How the memory should be mapped
> >> + *
<snip>
> >> +int zpool_evict(void *pool, unsigned long handle)
> >> +{
> >> + struct zpool *zpool;
> >> +
> >> + spin_lock(&pools_lock);
> >> + list_for_each_entry(zpool, &pools_head, list) {
> >
> > You can do a container_of() here:
> >
> > zpool = container_of(pool, struct zpool, pool);
>
> unfortunately, that's not true, since the driver pool isn't actually a
> member of the struct zpool. The struct zpool only has a pointer to
> the driver pool.
Ah yes, got my user API vs driver API crossed here :-/
Meh, can't think of a better way for now and it doesn't cause contention
on the hot paths so... works for me.
Seth
>
> I really wanted to use container_of(), but I think zbud/zsmalloc would
> need alternate pool creation functions that create struct zpools of
> the appropriate size with their pool embedded, and the
> driver->create() function would need to alloc and return the entire
> struct zpool, instead of just the driver pool. Do you think that's a
> better approach? Or is there another better way I'm missing?
>
--
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>
next prev parent reply other threads:[~2014-05-29 3:48 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-19 15:52 [PATCH 0/4] mm: zpool: add common api for zswap to use zbud/zsmalloc Dan Streetman
2014-04-19 15:52 ` [PATCH 1/4] mm: zpool: zbud_alloc() minor param change Dan Streetman
2014-04-19 15:52 ` [PATCH 2/4] mm: zpool: implement zsmalloc shrinking Dan Streetman
2014-04-26 8:37 ` Weijie Yang
2014-04-27 4:13 ` Dan Streetman
2014-05-02 20:01 ` Seth Jennings
2014-05-04 20:38 ` Dan Streetman
2014-04-19 15:52 ` [PATCH 3/4] mm: zpool: implement common zpool api to zbud/zsmalloc Dan Streetman
2014-04-22 10:05 ` Sergey Senozhatsky
2014-04-22 13:43 ` Dan Streetman
2014-04-19 15:52 ` [PATCH 4/4] mm: zpool: update zswap to use zpool Dan Streetman
2014-04-21 2:47 ` [PATCH 0/4] mm: zpool: add common api for zswap to use zbud/zsmalloc Weijie Yang
2014-05-07 21:51 ` [PATCHv2 0/4] mm/zpool: " Dan Streetman
2014-05-07 21:51 ` [PATCHv2 1/4] mm/zbud: zbud_alloc() minor param change Dan Streetman
2014-05-09 3:33 ` Seth Jennings
2014-05-07 21:51 ` [PATCH 2/4] mm/zbud: change zbud_alloc size type to size_t Dan Streetman
2014-05-09 3:33 ` Seth Jennings
2014-05-07 21:51 ` [PATCHv2 3/4] mm/zpool: implement common zpool api to zbud/zsmalloc Dan Streetman
2014-05-09 4:13 ` Seth Jennings
2014-05-10 16:06 ` Dan Streetman
2014-05-07 21:51 ` [PATCHv2 4/4] mm/zswap: update zswap to use zpool Dan Streetman
2014-05-24 19:06 ` [PATCHv3 0/6] mm/zpool: add common api for zswap to use zbud/zsmalloc Dan Streetman
2014-05-24 19:06 ` [PATCHv2 1/6] mm/zbud: zbud_alloc() minor param change Dan Streetman
2014-05-24 19:06 ` [PATCH 2/6] mm/zbud: change zbud_alloc size type to size_t Dan Streetman
2014-05-24 19:06 ` [PATCHv3 3/6] mm/zpool: implement common zpool api to zbud/zsmalloc Dan Streetman
2014-05-27 22:06 ` Seth Jennings
2014-05-27 22:48 ` Seth Jennings
2014-05-28 0:06 ` Dan Streetman
2014-05-29 3:48 ` Seth Jennings [this message]
2014-05-24 19:06 ` [PATCH 4/6] mm/zpool: zbud/zsmalloc implement zpool Dan Streetman
2014-05-24 19:06 ` [PATCHv3 5/6] mm/zpool: update zswap to use zpool Dan Streetman
2014-05-24 19:06 ` [PATCH 6/6] mm/zpool: prevent zbud/zsmalloc from unloading when used Dan Streetman
2014-05-27 22:40 ` Seth Jennings
2014-05-28 0:40 ` Dan Streetman
2014-05-27 22:44 ` [PATCHv3 0/6] mm/zpool: add common api for zswap to use zbud/zsmalloc Seth Jennings
2014-06-02 22:19 ` [PATCHv4 " Dan Streetman
2014-06-02 22:19 ` [PATCHv2 1/6] mm/zbud: zbud_alloc() minor param change Dan Streetman
2014-06-23 21:19 ` Andrew Morton
2014-06-24 15:24 ` Dan Streetman
2014-06-02 22:19 ` [PATCH 2/6] mm/zbud: change zbud_alloc size type to size_t Dan Streetman
2014-06-02 22:19 ` [PATCHv4 3/6] mm/zpool: implement common zpool api to zbud/zsmalloc Dan Streetman
2014-06-23 21:46 ` Andrew Morton
2014-06-24 15:39 ` Dan Streetman
2014-06-24 23:08 ` Andrew Morton
2014-06-27 17:11 ` Dan Streetman
2014-06-27 19:17 ` Andrew Morton
2014-06-02 22:19 ` [PATCHv2 4/6] mm/zpool: zbud/zsmalloc implement zpool Dan Streetman
2014-06-02 22:19 ` [PATCHv4 5/6] mm/zpool: update zswap to use zpool Dan Streetman
2014-06-02 22:19 ` [PATCHv2 6/6] mm/zpool: prevent zbud/zsmalloc from unloading when used Dan Streetman
2014-06-23 21:48 ` Andrew Morton
2014-06-24 15:41 ` Dan Streetman
2014-06-04 1:38 ` [PATCHv4 0/6] mm/zpool: add common api for zswap to use zbud/zsmalloc Bob Liu
2014-06-06 21:01 ` Seth Jennings
2014-07-02 21:43 ` [PATCHv5 0/4] " Dan Streetman
2014-07-02 21:45 ` Dan Streetman
2014-07-02 21:45 ` [PATCHv2 1/4] mm/zbud: change zbud_alloc size type to size_t Dan Streetman
2014-07-02 21:45 ` [PATCHv5 2/4] mm/zpool: implement common zpool api to zbud/zsmalloc Dan Streetman
2014-07-02 21:45 ` [PATCHv3 3/4] mm/zpool: zbud/zsmalloc implement zpool Dan Streetman
2014-07-02 21:45 ` [PATCHv5 4/4] mm/zpool: update zswap to use zpool Dan Streetman
2014-07-14 18:10 ` [PATCHv5 0/4] mm/zpool: add common api for zswap to use zbud/zsmalloc Dan Streetman
2014-07-16 20:59 ` Seth Jennings
2014-07-16 21:05 ` Dan Streetman
2014-07-16 22:00 ` Seth Jennings
2014-07-25 16:59 ` Dan Streetman
2014-07-28 20:40 ` 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=20140529034835.GA18063@cerebellum.variantweb.net \
--to=sjennings@variantweb.net \
--cc=akpm@linux-foundation.org \
--cc=bob.liu@oracle.com \
--cc=ddstreet@ieee.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=riel@redhat.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=weijie.yang@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox