Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1292723

Re: [PATCH] mm: mempool: Factor out mempool_refill()

From Zhi Wang <zhi.a.wang@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: mempool: Factor out mempool_refill()
Date 2015-12-16 04:30 +0100
Message-ID <qGaWS-4Ns-9@gated-at.bofh.it> (permalink)
References <qF5Pz-30P-3@gated-at.bofh.it> <qFzaV-5m6-11@gated-at.bofh.it> <qG5ku-1bL-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm: mempool: Factor out mempool_refill() Zhi Wang <zhi.a.wang@intel.com> - 2015-12-13 04:50 +0100
  [PATCH] mm: mempool: Factor out mempool_refill() "Wang, Zhi A" <zhi.a.wang@intel.com> - 2015-12-13 16:40 +0100
  [PATCH] mm: mempool: Factor out mempool_refill() "Wang, Zhi A" <zhi.a.wang@intel.com> - 2015-12-14 12:10 +0100
    Re: [PATCH] mm: mempool: Factor out mempool_refill() Johannes Weiner <hannes@cmpxchg.org> - 2015-12-15 22:30 +0100
      Re: [PATCH] mm: mempool: Factor out mempool_refill() Zhi Wang <zhi.a.wang@intel.com> - 2015-12-16 04:30 +0100

csiph-web