[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121230095338.GC1575@minipsycho.orion>
Date: Sun, 30 Dec 2012 10:53:38 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org, edumazet@...gle.com,
bhutchings@...arflare.com, faisal.latif@...el.com,
shemminger@...tta.com, fbl@...hat.com, roland@...nel.org,
sean.hefty@...el.com, hal.rosenstock@...il.com, fubar@...ibm.com,
andy@...yhouse.net, divy@...lsio.com, jitendra.kalsaria@...gic.com,
sony.chacko@...gic.com, linux-driver@...gic.com, kaber@...sh.net,
ursula.braun@...ibm.com, blaschka@...ux.vnet.ibm.com,
schwidefsky@...ibm.com, heiko.carstens@...ibm.com,
ebiederm@...ssion.com, joe@...ches.com, amwang@...hat.com,
nhorman@...driver.com, john.r.fastabend@...el.com,
pablo@...filter.org
Subject: Re: [patch net-next 01/15] net: introduce upper device lists
Sun, Dec 30, 2012 at 12:31:01AM CET, davem@...emloft.net wrote:
>From: Jiri Pirko <jiri@...nulli.us>
>Date: Sat, 29 Dec 2012 11:38:28 +0100
>
>> + /*
>> + * To prevent loops, check if dev is not upper device to upper_dev.
>> + */
>
>Please use:
>
> /* To prevent loops, check if dev is not upper device to upper_dev. */
fixed
>
>> +/**
>> + * netdev_upper_free_rcu - Frees a upper device list item via the RCU pointer
>> + * @entry: the entry's RCU field
>> + *
>> + * This function is designed to be used as a callback to the call_rcu()
>> + * function so that the memory allocated to the netdev upper device list item
>> + * can be released safely.
>> + */
>> +static void netdev_upper_free_rcu(struct rcu_head *entry)
>> +{
>> + struct netdev_upper *upper;
>> +
>> + upper = container_of(entry, struct netdev_upper, rcu);
>> + kfree(upper);
>> +}
>
>Please use kfree_rcu().
fixed
>
>Also, since __netdev_has_upper_dev() modifies &search_list inside
>of the list traversal loop, I think you really need to use
>list_for_each_entry_safe() even though you always append to the
>tail of &search_list.
Hmm, I do not believe that list_for_each_entry_safe() would work correctly
here. In case that the current iterator is at the very end of
the list and now other items are added, list_for_each_entry_safe() would
remember that next is head and the newly added items would not be
processed. list_for_each_entry() works just fine in any case I can
imagine. Note that no items are removed during the iteration.
Am I missing something?
Thanks!
Jiri
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists