[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200403181655.GR21484@bombadil.infradead.org>
Date: Fri, 3 Apr 2020 11:16:55 -0700
From: Matthew Wilcox <willy@...radead.org>
To: "Uladzislau Rezki (Sony)" <urezki@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Joel Fernandes <joel@...lfernandes.org>,
RCU <rcu@...r.kernel.org>, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@...ymobile.com>
Subject: Re: [PATCH 1/1] rcu/tree: add emergency pool for headless case
On Fri, Apr 03, 2020 at 07:30:51PM +0200, Uladzislau Rezki (Sony) wrote:
> @@ -2877,6 +2885,12 @@ struct kfree_rcu_cpu {
> bool initialized;
> // Number of objects for which GP not started
> int count;
> +
> + /*
> + * Reserved emergency pool for headless variant.
> + */
> + int nr_emergency;
> + void **emergency;
This is a pretty expensive way to maintain an emergency pool.
Try something like this ...
struct emergency_pool_object {
union {
struct whatever foo;
struct {
int remaining;
void *next;
};
};
};
struct kfree_rcu_cpu {
...
struct emergency_pool_object *epo;
};
struct whatever *get_emergency_object(struct kfree_rcu_cpu *krc)
{
struct emergency_pool_object *epo = krc->epo;
if (epo)
krc->epo = epo->next;
return &epo->foo;
}
void alloc_emergency_objects(struct kfree_rcu_cpu *krc, int n)
{
int i = 0;
if (krc->epo)
i = krc->epo->remaining;
while (++i < n) {
struct emergency_pool_object *epo = kmalloc(sizeof(epo), GFP);
epo->remaining = i;
epo->next = krc->epo;
krc->epo = epo;
}
}
Powered by blists - more mailing lists