From: "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Christophe JAILLET
<christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] RDS: Simplify code
Date: Tue, 06 Sep 2016 00:22:06 +0000 [thread overview]
Message-ID: <26832741-da10-7581-11d2-d88e6df43c4e@oracle.com> (raw)
In-Reply-To: <20160904182354.GR21847-2ukJVAZIZ/Y@public.gmane.org>
On 9/4/16 11:23 AM, Leon Romanovsky wrote:
> On Sun, Sep 04, 2016 at 05:57:20PM +0200, Christophe JAILLET wrote:
>> Le 04/09/2016 à 14:20, Leon Romanovsky a écrit :
>>> On Sat, Sep 03, 2016 at 07:33:29AM +0200, Christophe JAILLET wrote:
>>>> Calling 'list_splice' followed by 'INIT_LIST_HEAD' is equivalent to
>>>> 'list_splice_init'.
>>> It is not 100% accurate
>>>
>>> list_splice(y, z)
>>> INIT_LIST_HEAD(y)
>>>
>>> =>
>>>
>>> if (!list_empty(y))
>>> __list_splice(y, z, z>next);
>>> INIT_LIST_HEAD(y)
>>>
>>> and not
>>>
>>> if (!list_empty(y)) {
>>> __list_splice(y, z, z>next);
>>> INIT_LIST_HEAD(y)
>>> }
>>>
>>> as list_splice_init will do.
>>>
>> You are right but if you dig further you will see that calling
>> INIT_LIST_HEAD on an empty list is a no-op (AFAIK).
>> And if this list was not already correctly initialized, then you would have
>> some other troubles.
>
> Thank you for the suggestion,
> It looks like the code after that can be skipped in case of loop_conns
> list is empty, the tmp_list will be empty too.
>
> 174 list_for_each_entry_safe(lc, _lc, &tmp_list, loop_node) {
> 175 WARN_ON(lc->conn->c_passive);
> 176 rds_conn_destroy(lc->conn);
> 177 }
>
Thanks for trying. As already pointed, your change doesn't simplify
much rather change the behavior. The loop cursor already takes care
of list empty case. I don't see any reason to change that code.
Regards,
Santosh
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2016-09-06 0:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-03 5:33 [PATCH] RDS: Simplify code Christophe JAILLET
2016-09-04 12:20 ` Leon Romanovsky
2016-09-04 15:57 ` Christophe JAILLET
[not found] ` <befa1a39-cfc5-721f-e39a-369436237b1c-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
2016-09-04 18:23 ` Leon Romanovsky
[not found] ` <73fc4be8-2530-b9ab-945b-887db6dca2a6@wanadoo.fr>
2016-09-05 5:14 ` Leon Romanovsky
[not found] ` <20160904182354.GR21847-2ukJVAZIZ/Y@public.gmane.org>
2016-09-06 0:22 ` santosh.shilimkar [this message]
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=26832741-da10-7581-11d2-d88e6df43c4e@oracle.com \
--to=santosh.shilimkar@oracle.com \
--cc=christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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