All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhi Wang <zhi.a.wang@intel.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] mm: mempool: Factor out mempool_refill()
Date: Wed, 16 Dec 2015 11:19:56 +0800	[thread overview]
Message-ID: <5670D85C.60106@intel.com> (raw)
In-Reply-To: <20151215212638.GA17162@cmpxchg.org>

Hi Johannes:
     Thanks for the reply. In the end of the mempool_resize(), it will 
call the mempool_refill() to do the rest of the work. So this is not one 
of the "no-caller" case. If you insist this is a "no-caller" case, 
perhaps I should change it to a "static" function without exposing a new 
interface?

Personally I think mempool_refill() should be one of the typical 
interfaces in an implementation of a mempool. Currently the mempool will 
not grow only if pool->min_nr > new_min_nr.

So when user wants to refill the mempool immediately, not resize a 
mempool, in the current implementation, it has to do 2x 
mempool_resize(). First one is mempool_resize(pool->min_nr - 1), second 
one is mempool_resize(new_min_nr). So the refill action would truly 
happen. This is ugly and not convenient.

On 12/16/15 05:26, Johannes Weiner wrote:
> On Mon, Dec 14, 2015 at 11:09:43AM +0000, Wang, Zhi A wrote:
>> This patch factors out mempool_refill() from mempool_resize(). It's reasonable
>> that the mempool user wants to refill the pool immdiately when it has chance
>> e.g. inside a sleepible context, so that next time in the IRQ context the pool
>> would have much more available elements to allocate.
>>
>> After the refactor, mempool_refill() can also executes with mempool_resize()
>> /mempool_alloc/mempool_free() or another mempool_refill().
>>
>> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
>
> Who is going to call that function? Adding a new interace usually
> comes with a user, or as part of a series that adds users.
>

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

WARNING: multiple messages have this Message-ID (diff)
From: Zhi Wang <zhi.a.wang@intel.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] mm: mempool: Factor out mempool_refill()
Date: Wed, 16 Dec 2015 11:19:56 +0800	[thread overview]
Message-ID: <5670D85C.60106@intel.com> (raw)
In-Reply-To: <20151215212638.GA17162@cmpxchg.org>

Hi Johannes:
     Thanks for the reply. In the end of the mempool_resize(), it will 
call the mempool_refill() to do the rest of the work. So this is not one 
of the "no-caller" case. If you insist this is a "no-caller" case, 
perhaps I should change it to a "static" function without exposing a new 
interface?

Personally I think mempool_refill() should be one of the typical 
interfaces in an implementation of a mempool. Currently the mempool will 
not grow only if pool->min_nr > new_min_nr.

So when user wants to refill the mempool immediately, not resize a 
mempool, in the current implementation, it has to do 2x 
mempool_resize(). First one is mempool_resize(pool->min_nr - 1), second 
one is mempool_resize(new_min_nr). So the refill action would truly 
happen. This is ugly and not convenient.

On 12/16/15 05:26, Johannes Weiner wrote:
> On Mon, Dec 14, 2015 at 11:09:43AM +0000, Wang, Zhi A wrote:
>> This patch factors out mempool_refill() from mempool_resize(). It's reasonable
>> that the mempool user wants to refill the pool immdiately when it has chance
>> e.g. inside a sleepible context, so that next time in the IRQ context the pool
>> would have much more available elements to allocate.
>>
>> After the refactor, mempool_refill() can also executes with mempool_resize()
>> /mempool_alloc/mempool_free() or another mempool_refill().
>>
>> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
>
> Who is going to call that function? Adding a new interace usually
> comes with a user, or as part of a series that adds users.
>

  reply	other threads:[~2015-12-16  3:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13  3:46 [PATCH] mm: mempool: Factor out mempool_refill() Zhi Wang
2015-12-13 15:35 ` Wang, Zhi A
2015-12-14 11:09 ` Wang, Zhi A
2015-12-14 11:09   ` Wang, Zhi A
2015-12-15 21:26   ` Johannes Weiner
2015-12-15 21:26     ` Johannes Weiner
2015-12-16  3:19     ` Zhi Wang [this message]
2015-12-16  3:19       ` Zhi Wang
  -- strict thread matches above, loose matches on Subject: below --
2015-12-11 16:23 Zhi Wang
2015-12-11  6:18 Zhi Wang
2015-12-11  6:18 ` Zhi Wang

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=5670D85C.60106@intel.com \
    --to=zhi.a.wang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.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.