[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdQsrxS5=Jb_+Wfu=JL0-AR1B=p8Jp3psEqH5ApmpewGA@mail.gmail.com>
Date: Fri, 29 Jun 2018 23:38:16 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Pavel Tatashin <pasha.tatashin@...cle.com>
Cc: Steven Sistare <steven.sistare@...cle.com>,
Daniel Jordan <daniel.m.jordan@...cle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
intel-wired-lan@...ts.osuosl.org, netdev <netdev@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexander Duyck <alexander.duyck@...il.com>, tobin@...orbit.com
Subject: Re: [PATCH v6 2/3] drivers core: prepare device_shutdown for multi-threading
On Fri, Jun 29, 2018 at 9:25 PM, Pavel Tatashin
<pasha.tatashin@...cle.com> wrote:
> Do all the necessary refactoring to prepare device_shutdown() logic to
> be multi-threaded.
>
> Which includes:
> 1. Change the direction of traversing the list instead of going backward,
> we now go forward.
> 2. Children are shutdown recursively for each root device from bottom-up.
> 3. Functions that can be multi-threaded have _task() in their name.
> +/*
> + * device_children_count - device children count
> + * @parent: parent struct device.
> + *
> + * Returns number of children for this device or 0 if none.
> + */
> +static int device_children_count(struct device *parent)
> +{
> + struct klist_iter i;
> + int children = 0;
> +
> + if (!parent->p)
> + return 0;
> +
> + klist_iter_init(&parent->p->klist_children, &i);
> + while (next_device(&i))
> + children++;
> + klist_iter_exit(&i);
> +
> + return children;
> +}
Looking at another patch in LKML (for gluedir children counting) I
would suggest to consider to cache children value.
Would it make sense?
(So, basically you would update that value on children registered / removed)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists