[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200617234609.GA10087@paulmck-ThinkPad-P72>
Date: Wed, 17 Jun 2020 16:46:09 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: "Uladzislau Rezki (Sony)" <urezki@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
"Theodore Y . Ts'o" <tytso@....edu>,
Matthew Wilcox <willy@...radead.org>,
Joel Fernandes <joel@...lfernandes.org>,
RCU <rcu@...r.kernel.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@...ymobile.com>
Subject: Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc
ptrs
On Mon, May 25, 2020 at 11:47:53PM +0200, Uladzislau Rezki (Sony) wrote:
> To do so, we use an array of kvfree_rcu_bulk_data structures.
> It consists of two elements:
> - index number 0 corresponds to slab pointers.
> - index number 1 corresponds to vmalloc pointers.
>
> Keeping vmalloc pointers separated from slab pointers makes
> it possible to invoke the right freeing API for the right
> kind of pointer.
>
> It also prepares us for future headless support for vmalloc
> and SLAB objects. Such objects cannot be queued on a linked
> list and are instead directly into an array.
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
> Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> Co-developed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> ---
[ . . . ]
> + // Handle two first channels.
> + for (i = 0; i < FREE_N_CHANNELS; i++) {
> + for (; bkvhead[i]; bkvhead[i] = bnext) {
> + bnext = bkvhead[i]->next;
> + debug_rcu_bhead_unqueue(bkvhead[i]);
> +
> + rcu_lock_acquire(&rcu_callback_map);
> + if (i == 0) { // kmalloc() / kfree().
> + trace_rcu_invoke_kfree_bulk_callback(
> + rcu_state.name, bkvhead[i]->nr_records,
> + bkvhead[i]->records);
> +
> + kfree_bulk(bkvhead[i]->nr_records,
> + bkvhead[i]->records);
> + } else { // vmalloc() / vfree().
> + for (j = 0; j < bkvhead[i]->nr_records; j++) {
> + trace_rcu_invoke_kfree_callback(
> + rcu_state.name,
> + bkvhead[i]->records[j], 0);
> +
> + vfree(bkvhead[i]->records[j]);
> + }
> + }
> + rcu_lock_release(&rcu_callback_map);
Not an emergency, but did you look into replacing this "if" statement
with an array of pointers to functions implementing the legs of the
"if" statement? If nothing else, this would greatly reduced indentation.
I am taking this as is, but if you have not already done so, could you
please look into this for a follow-up patch?
Thanx, Paul
Powered by blists - more mailing lists