[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fd1641e5-0e75-30a9-a5b7-2a762cefabf1@oracle.com>
Date: Fri, 29 Jun 2018 17:20:16 -0400
From: Pavel Tatashin <pasha.tatashin@...cle.com>
To: Andy Shevchenko <andy.shevchenko@...il.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 06/29/2018 04:38 PM, Andy Shevchenko wrote:
> 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)
>
Hi Andy,
Thank you for looking at this patch.
For this particular series, this function is called only once per device during shutdown, when nothing else is running on the machine. So, caching won't really provide us any improvement.
If, in the future this function is going to be called from other sites during run-time of the machine, then yes, that would mean that caching might help.
Thank you,
Pavel
Powered by blists - more mailing lists