linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <lliubbo@gmail.com>
To: Cai Liu <liucai.lfn@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Bob Liu <bob.liu@oracle.com>, Cai Liu <cai.liu@samsung.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm/zswap: Check all pool pages instead of one pool pages
Date: Tue, 21 Jan 2014 11:58:46 +0800	[thread overview]
Message-ID: <CAA_GA1eR++9u+WrCnv-eLoAa-6K18aQwLJ+TkpC8LGQPEeHGSQ@mail.gmail.com> (raw)
In-Reply-To: <CAFLCcBqyhL=wfC4uJmpp9MkGExBuPJC4EqY2RHRngnEn_1ytSA@mail.gmail.com>

On Tue, Jan 21, 2014 at 11:07 AM, Cai Liu <liucai.lfn@gmail.com> wrote:
> Thanks for your review.
>
> 2014/1/21 Minchan Kim <minchan@kernel.org>:
>> Hello Cai,
>>
>> On Mon, Jan 20, 2014 at 03:50:18PM +0800, Cai Liu wrote:
>>> zswap can support multiple swapfiles. So we need to check
>>> all zbud pool pages in zswap.
>>>
>>> Version 2:
>>>   * add *total_zbud_pages* in zbud to record all the pages in pools
>>>   * move the updating of pool pages statistics to
>>>     alloc_zbud_page/free_zbud_page to hide the details
>>>
>>> Signed-off-by: Cai Liu <cai.liu@samsung.com>
>>> ---
>>>  include/linux/zbud.h |    2 +-
>>>  mm/zbud.c            |   44 ++++++++++++++++++++++++++++++++------------
>>>  mm/zswap.c           |    4 ++--
>>>  3 files changed, 35 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/include/linux/zbud.h b/include/linux/zbud.h
>>> index 2571a5c..1dbc13e 100644
>>> --- a/include/linux/zbud.h
>>> +++ b/include/linux/zbud.h
>>> @@ -17,6 +17,6 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle);
>>>  int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
>>>  void *zbud_map(struct zbud_pool *pool, unsigned long handle);
>>>  void zbud_unmap(struct zbud_pool *pool, unsigned long handle);
>>> -u64 zbud_get_pool_size(struct zbud_pool *pool);
>>> +u64 zbud_get_pool_size(void);
>>>
>>>  #endif /* _ZBUD_H_ */
>>> diff --git a/mm/zbud.c b/mm/zbud.c
>>> index 9451361..711aaf4 100644
>>> --- a/mm/zbud.c
>>> +++ b/mm/zbud.c
>>> @@ -52,6 +52,13 @@
>>>  #include <linux/spinlock.h>
>>>  #include <linux/zbud.h>
>>>
>>> +/*********************************
>>> +* statistics
>>> +**********************************/
>>> +
>>> +/* zbud pages in all pools */
>>> +static u64 total_zbud_pages;
>>> +
>>>  /*****************
>>>   * Structures
>>>  *****************/
>>> @@ -142,10 +149,28 @@ static struct zbud_header *init_zbud_page(struct page *page)
>>>       return zhdr;
>>>  }
>>>
>>> +static struct page *alloc_zbud_page(struct zbud_pool *pool, gfp_t gfp)
>>> +{
>>> +     struct page *page;
>>> +
>>> +     page = alloc_page(gfp);
>>> +
>>> +     if (page) {
>>> +             pool->pages_nr++;
>>> +             total_zbud_pages++;
>>
>> Who protect race?
>
> Yes, here the pool->pages_nr and also the total_zbud_pages are not protected.
> I will re-do it.
>
> I will change *total_zbud_pages* to atomic type.

And how about just add total_zbud_pages++ and leave pool->pages_nr in
its original place which already protected by pool->lock?

> For *pool->pages_nr*, one way is to use pool->lock to protect. But I
> think it is too heavy.
> So does it ok to change pages_nr to atomic type too?
>

-- 
Regards,
--Bob

--
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>

  reply	other threads:[~2014-01-21  3:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21  3:07 Cai Liu
2014-01-21  3:58 ` Bob Liu [this message]
2014-01-21  5:04 ` Minchan Kim
2014-01-21  6:35   ` Cai Liu
2014-01-21  8:18     ` Minchan Kim
2014-01-21 13:52       ` Cai Liu
2014-01-22  8:02         ` Minchan Kim
2014-01-22 12:16           ` Cai Liu
2014-01-22 14:14             ` Dan Streetman
2014-01-23  1:38               ` Cai Liu
2014-01-23  3:02                 ` Minchan Kim
2014-01-23  6:30                   ` Cai Liu
2014-01-24 14:20                     ` Weijie Yang
2014-01-27  2:21                       ` Minchan Kim
  -- strict thread matches above, loose matches on Subject: below --
2014-01-20  7:50 Cai Liu
2014-01-21  2:32 ` Minchan Kim

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=CAA_GA1eR++9u+WrCnv-eLoAa-6K18aQwLJ+TkpC8LGQPEeHGSQ@mail.gmail.com \
    --to=lliubbo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bob.liu@oracle.com \
    --cc=cai.liu@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liucai.lfn@gmail.com \
    --cc=minchan@kernel.org \
    --cc=sjenning@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox