From: Pavel Tatashin <pasha.tatashin@oracle.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Steven Sistare <steven.sistare@oracle.com>,
Daniel Jordan <daniel.m.jordan@oracle.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev <netdev@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Duyck <alexander.duyck@gmail.com>,
tobin@apporbit.com
Subject: Re: [PATCH v6 2/3] drivers core: prepare device_shutdown for multi-threading
Date: Fri, 29 Jun 2018 17:20:16 -0400 [thread overview]
Message-ID: <fd1641e5-0e75-30a9-a5b7-2a762cefabf1@oracle.com> (raw)
In-Reply-To: <CAHp75VdQsrxS5=Jb_+Wfu=JL0-AR1B=p8Jp3psEqH5ApmpewGA@mail.gmail.com>
On 06/29/2018 04:38 PM, Andy Shevchenko wrote:
> On Fri, Jun 29, 2018 at 9:25 PM, Pavel Tatashin
> <pasha.tatashin@oracle.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
next prev parent reply other threads:[~2018-06-29 21:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 18:25 [PATCH v6 0/3] multi-threading device shutdown Pavel Tatashin
2018-06-29 18:25 ` [PATCH v6 1/3] drivers core: refactor device_shutdown Pavel Tatashin
2018-06-29 18:25 ` [PATCH v6 2/3] drivers core: prepare device_shutdown for multi-threading Pavel Tatashin
2018-06-29 20:38 ` Andy Shevchenko
2018-06-29 21:20 ` Pavel Tatashin [this message]
2018-06-29 18:25 ` [PATCH v6 3/3] drivers core: multi-threading device shutdown Pavel Tatashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd1641e5-0e75-30a9-a5b7-2a762cefabf1@oracle.com \
--to=pasha.tatashin@oracle.com \
--cc=alexander.duyck@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=daniel.m.jordan@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steven.sistare@oracle.com \
--cc=tobin@apporbit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox