Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 28/36] net,rcu: convert call_rcu(phonet_device_rcu_free) to kfree_rcu()
From: Rémi Denis-Courmont @ 2011-03-18  8:27 UTC (permalink / raw)
  To: ext Lai Jiangshan
  Cc: Paul E. McKenney, Ingo Molnar, David S. Miller, netdev,
	linux-kernel
In-Reply-To: <4D82DADF.4010802@cn.fujitsu.com>

On Friday 18 March 2011 06:09:03 ext Lai Jiangshan, you wrote:
> The rcu callback phonet_device_rcu_free() just calls a kfree(),
> so we use kfree_rcu() instead of the call_rcu(phonet_device_rcu_free).
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>

In principles, that's fine with me. But I think David is not taking that kind 
of not-a-fix patch at the moment...

-- 
Rémi Denis-Courmont
http://www.remlab.net/

^ permalink raw reply

* Re: VLAN over GRE segfault
From: Eric Dumazet @ 2011-03-18  8:26 UTC (permalink / raw)
  To: Diddi Oscarsson; +Cc: netdev
In-Reply-To: <4D830AF9.8040007@diddi.se>

Le vendredi 18 mars 2011 à 08:34 +0100, Diddi Oscarsson a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello!
> 
> I was trying to get ethernet over GRE to work when I found an obvious
> way NOT to do it.
> Basically I created a VLAN interface from the GRE interface (even
> though I had my fair doubts it would work) which gave me a nice segfault.
> The problem with this is that after the segfault, new network
> connections cannot be made (ping, ssh, http, whatever) and a reboot of
> the computer is necessary.
> I think an error message needs to be added when trying an operation
> like this.

Hmm, thanks for the report, I'll submit a patch to fix this
(NETIF_F_VLAN_CHALLENGED needed on some devices)



^ permalink raw reply

* VLAN over GRE segfault
From: Diddi Oscarsson @ 2011-03-18  7:34 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

I was trying to get ethernet over GRE to work when I found an obvious
way NOT to do it.
Basically I created a VLAN interface from the GRE interface (even
though I had my fair doubts it would work) which gave me a nice segfault.
The problem with this is that after the segfault, new network
connections cannot be made (ping, ssh, http, whatever) and a reboot of
the computer is necessary.
I think an error message needs to be added when trying an operation
like this.

My system:
Linux colalapp 2.6.37-2-amd64 #1 SMP Sun Feb 27 10:12:22 UTC 2011
x86_64 GNU/Linux
ip utility, iproute2-ss110107
Debian unstable

Steps to reproduce:
ip tunnel add gre0 mode gre
ip link add link gre0 name vlan1 type vlan id 1
ip link set vlan1 address 00:15:14:13:12:11
ip link set gre0 up
ip link set vlan1 up
<CRASH>
Attached in the mail is an output from dmesg right after the segfault.

Regarding ethernet over gre, I've just found out about gretap which
I'm testing right now.
BR
Diddi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNgwr5AAoJEA4EcRXoFHyYL+4H/iENafoHp780qO2Kjfz1UWkj
XDAijBm+CI7cq+0Bs3VgvtP86ym/Qe5ueJok+dm4nfrboLpg93Z3UssbvF9RbngI
CJllJ+jIMDPJveioSEif8VIiaPT3LVkp2DO2nDOgRMdAFfYANzWQCX44FJTtX11v
R5gtYPLxv0v6iODhBMcYorTeC/x+Z607K7QaoSQhmKqt/ehw1bG2c30zHCUBNKMS
mU216M811ZDr87JQ86hm8ADkQUrCzoi50yAMjX0M0iiOX/yjyLD2VnqWNco0bPJE
CgH+5Bc8+6jNRsofYoi8d5g+g7Q2RpA7Xx1kiJrD2sR6SKr+vjTt/DIsSY+SXNA=
=mWZT
-----END PGP SIGNATURE-----


[-- Attachment #2: crash.log --]
[-- Type: text/plain, Size: 5904 bytes --]

[396626.662104] device gre0 entered promiscuous mode
[396626.662561] skb_under_panic: text:ffffffffa0935af7 len:80 put:24 head:ffff880078b8d000 data:ffff880078b8cff8 tail:0x48 end:0x100 dev:veth0
[396626.662742] ------------[ cut here ]------------
[396626.662790] kernel BUG at /build/buildd-linux-2.6_2.6.37-2-amd64-bITS0h/linux-2.6-2.6.37/debian/build/source_amd64_none/net/core/skbuff.c:146!
[396626.662891] invalid opcode: 0000 [#1] SMP 
[396626.662932] last sysfs file: /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes
[396626.663010] CPU 0 
[396626.663029] Modules linked in: tun macvlan dummy 8021q garp stp ip_gre gre veth binfmt_misc fuse loop firewire_sbp2 btusb bluetooth snd_hda_codec_analog snd_hda_intel arc4 ecb snd_hda_codec iwl3945 thinkpad_acpi iwlcore snd_hwdep snd_pcm i915 snd_seq drm_kms_helper snd_timer drm mac80211 snd_seq_device pcmcia snd snd_page_alloc i2c_i801 soundcore cfg80211 yenta_socket i2c_algo_bit tpm_tis pcmcia_rsrc pcmcia_core i2c_core battery tpm ac tpm_bios nvram power_supply serio_raw psmouse video pcspkr output rfkill evdev processor button ext3 jbd mbcache sha256_generic cryptd aes_x86_64 aes_generic cbc dm_crypt dm_mod sd_mod crc_t10dif mmc_block ahci libahci ata_piix uhci_hcd ata_generic libata ehci_hcd scsi_mod firewire_ohci sdhci_pci sdhci usbcore mmc_core e1000e firewire_core thermal crc_it
 u_t thermal_sys nls_base [last unloaded: scsi_wait_scan]
[396626.663977] 
[396626.663995] Pid: 1440, comm: ip Not tainted 2.6.37-2-amd64 #1 LENOVO 766929G/766929G
[396626.664105] RIP: 0010:[<ffffffff81261ef7>]  [<ffffffff81261ef7>] skb_push+0x6f/0x7b
[396626.664177] RSP: 0018:ffff88005cd63498  EFLAGS: 00010296
[396626.664221] RAX: 0000000000000095 RBX: ffff880019387000 RCX: 0000000000060d52
[396626.664279] RDX: 0000000000000000 RSI: 0000000000000046 RDI: 0000000000000246
[396626.664337] RBP: ffff8800780bbbf8 R08: 0000000000000002 R09: 0000000000000005
[396626.664395] R10: 0000000000000000 R11: 0000000000000001 R12: ffff8800193876c0
[396626.664453] R13: 000000000000dd86 R14: ffff8800469bfec0 R15: ffff88005cd635a8
[396626.664512] FS:  00007f18c2b21700(0000) GS:ffff88007d400000(0000) knlGS:0000000000000000
[396626.664576] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[396626.664624] CR2: 00007f18c22cc728 CR3: 000000001955c000 CR4: 00000000000006f0
[396626.664682] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[396626.664740] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[396626.664800] Process ip (pid: 1440, threadinfo ffff88005cd62000, task ffff880078132880)
[396626.664862] Stack:
[396626.664881]  0000000000000048 0000000000000100 ffff8800469bf800 ffff88005cd63518
[396626.664956]  0000000000000286 ffffffffa0935af7 ffff88005cd635a8 ffff88005ce4b7f0
[396626.665031]  ffffffff817f4a38 ffff880046862b00 ffff8800469bf800 0000000000000000
[396626.665106] Call Trace:
[396626.665137]  [<ffffffffa0935af7>] ? ipgre_header+0x2e/0x86 [ip_gre]
[396626.665193]  [<ffffffffa094d7e8>] ? vlan_dev_hard_header+0x121/0x139 [8021q]
[396626.665252]  [<ffffffff81053bcd>] ? mod_timer+0x87/0x8e
[396626.665300]  [<ffffffff812721b6>] ? neigh_connected_output+0x94/0xd3
[396626.665355]  [<ffffffff812e829c>] ? ndisc_send_skb+0x144/0x22d
[396626.665405]  [<ffffffff812e97ab>] ? ndisc_send_rs+0x8f/0x9a
[396626.665455]  [<ffffffff812dc422>] ? addrconf_dad_completed+0x71/0xb5
[396626.665508]  [<ffffffff812deaff>] ? addrconf_add_linklocal+0x6e/0x7d
[396626.665561]  [<ffffffff812e00c3>] ? addrconf_notify+0x59e/0x78e
[396626.665612]  [<ffffffff8128e16d>] ? rt_cache_flush+0x1a/0x51
[396626.665662]  [<ffffffff81321f16>] ? notifier_call_chain+0x2e/0x5b
[396626.665714]  [<ffffffff8126b157>] ? __dev_notify_flags+0x34/0x59
[396626.665764]  [<ffffffff8126b1b6>] ? dev_change_flags+0x3a/0x42
[396626.665815]  [<ffffffffa094c625>] ? vlan_device_event+0x42a/0x4ba [8021q]
[396626.665872]  [<ffffffff8128e16d>] ? rt_cache_flush+0x1a/0x51
[396626.668139]  [<ffffffff81321f16>] ? notifier_call_chain+0x2e/0x5b
[396626.670352]  [<ffffffff8126b157>] ? __dev_notify_flags+0x34/0x59
[396626.672524]  [<ffffffff8126b1b6>] ? dev_change_flags+0x3a/0x42
[396626.674682]  [<ffffffff81276ef9>] ? do_setlink+0x26f/0x5ce
[396626.676834]  [<ffffffff81276053>] ? rtnl_fill_ifinfo+0x88e/0x957
[396626.678911]  [<ffffffff8127761c>] ? rtnl_newlink+0x2b3/0x4cb
[396626.680934]  [<ffffffff812773fb>] ? rtnl_newlink+0x92/0x4cb
[396626.682897]  [<ffffffff812651e3>] ? __skb_recv_datagram+0x100/0x23d
[396626.684808]  [<ffffffff8128a3a6>] ? netlink_sendmsg+0x17e/0x294
[396626.686653]  [<ffffffff81276799>] ? rtnetlink_rcv_msg+0x0/0x1ea
[396626.688456]  [<ffffffff812899e1>] ? netlink_rcv_skb+0x34/0x7d
[396626.690221]  [<ffffffff81276790>] ? rtnetlink_rcv+0x1f/0x28
[396626.691893]  [<ffffffff812897cc>] ? netlink_unicast+0xe7/0x14f
[396626.693558]  [<ffffffff8128a49c>] ? netlink_sendmsg+0x274/0x294
[396626.695196]  [<ffffffff8125a876>] ? sock_sendmsg+0x83/0x9b
[396626.696792]  [<ffffffff810d0eef>] ? __do_fault+0x3bc/0x3f3
[396626.698382]  [<ffffffff812640cc>] ? copy_from_user+0x18/0x30
[396626.699924]  [<ffffffff81264410>] ? verify_iovec+0x46/0x98
[396626.701579]  [<ffffffff8125b009>] ? sys_sendmsg+0x22c/0x2b4
[396626.703154]  [<ffffffff8128a13b>] ? netlink_insert+0xfd/0x123
[396626.704721]  [<ffffffff81321eb0>] ? do_page_fault+0x324/0x35c
[396626.706236]  [<ffffffff810d591c>] ? do_brk+0x2ca/0x326
[396626.707710]  [<ffffffff8125ab56>] ? sys_recvmsg+0x4a/0x58
[396626.709198]  [<ffffffff81009a12>] ? system_call_fastpath+0x16/0x1b
[396626.710652] Code: 8b 57 68 48 89 44 24 10 8b 87 d0 00 00 00 48 89 44 24 08 8b bf cc 00 00 00 31 c0 48 89 3c 24 48 c7 c7 4a 32 4f 81 e8 9f af 0b 00 <0f> 0b eb fe 4c 89 c8 48 83 c4 28 c3 48 83 ec 28 83 7f 6c 00 89 
[396626.714396] RIP  [<ffffffff81261ef7>] skb_push+0x6f/0x7b
[396626.715992]  RSP <ffff88005cd63498>
[396626.724990] ---[ end trace 36ec1d4936ba3c26 ]---


[-- Attachment #3: crash.log.sig --]
[-- Type: application/octet-stream, Size: 287 bytes --]

^ permalink raw reply

* Re: [PATCH 05/36] block,rcu: convert call_rcu(disk_free_ptbl_rcu_cb) to kfree_rcu()
From: Jens Axboe @ 2011-03-18  6:59 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: Paul E. McKenney, Ingo Molnar, Robert Love, James E.J. Bottomley,
	Neil Horman, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, Eric Dumazet, Stephen Hemminger, Tejun Heo,
	Jarek Poplawski, linux-kernel, devel, linux-scsi, netdev
In-Reply-To: <4D82D4C2.8020503@cn.fujitsu.com>

On 2011-03-18 04:42, Lai Jiangshan wrote:
> 
> 
> The rcu callback disk_free_ptbl_rcu_cb() just calls a kfree(),
> so we use kfree_rcu() instead of the call_rcu(disk_free_ptbl_rcu_cb).

Thanks, I'll add this.

-- 
Jens Axboe


^ permalink raw reply

* Re: Poll about irqsafe_cpu_add and others
From: Benjamin Herrenschmidt @ 2011-03-18  6:56 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: linux-kernel, linux-arch, Christoph Lameter, netdev,
	Netfilter Development Mailinglist
In-Reply-To: <1300371834.6315.93.camel@edumazet-laptop>

On Thu, 2011-03-17 at 15:23 +0100, Eric Dumazet wrote:
> Hi
> 
> irqsafe_cpu_{dec|inc} are used in network stack since 2.6.37 (commit
> 29b4433d991c88), and I would like to use irqsafe_cpu_add() in netfilter
> fast path too, and SNMP counters eventually (to lower ram needs by 50%)
> 
> Initial support of irqsafe_ was given by Christoph in 2.6.34
> 
> It seems only x86 arch is using a native and efficient implementation.
> 
> Others use irqsafe_cpu_generic_to_op() and its pair of
> local_irq_save() / local_irq_restore()
> 
> Which other arches could use a native implementation ?
> 
> What about defining a HAVE_FAST_IRQSAFE_ADD ?

On powerpc, we use the generic one and it's fast :-) Well, at least on
ppc64, bcs we do lazy irq disabling, disabling/enabling interrupt is
basically just poking a byte in a per-cpu data structure (there's a tad
more work on enable in case the interrupt actually occured and we ended
up really disabling but that's not the common case). Overall faster than
using the atomic ops which have to go all the way to the L2 cache.

So if you define the above, please set in on powerpc despite the fact
that we use the generic implementation.

Cheers,
Ben.

^ permalink raw reply

* Re: sky2, vlan and nat/masquerading
From: Christian Hesse @ 2011-03-18  6:46 UTC (permalink / raw)
  To: Jesse Gross; +Cc: netdev
In-Reply-To: <20110317224044.3ff4fbd8@leda.vpn.lugor.de>

On Thu, 17 Mar 2011 22:40:44 +0100 Christian Hesse <mail@eworm.de> wrote:
> On Thu, 17 Mar 2011 12:23:48 -0700 Jesse Gross <jesse@nicira.com> wrote:
> > Can you try using ethtool to turn off txvlan and see if that makes a
> > difference?
> 
> Sure. I will give it a try tomorrow.

No, that does not make a difference.
-- 
Schoene Gruesse
Chris

^ permalink raw reply

* Re: [PATCH] Add useful per-connection TCP stats for diagnosis purpose.
From: Eric Dumazet @ 2011-03-18  6:05 UTC (permalink / raw)
  To: Jerry Chu; +Cc: Stephen Hemminger, netdev
In-Reply-To: <AANLkTi=W-=8zhQpfJZ=DrDyUCwrT==5JkwRBiHaDkVXK@mail.gmail.com>

Le jeudi 17 mars 2011 à 21:33 -0700, Jerry Chu a écrit :

> Yes I'm familiar with ss and how inet_csk_diag_fill() calls into
> tcp_diag_get_info(),..., etc. Like I mentioned previously the netlink
> interface
> requires a new version of reader app (e.g., ss) to ship every time a new
> counter is added and exported by the kernel, whereas /proc/net/tcp does
> not have such a problem.
> 
> Anyway I can add a INET_DIAG_INFO_EXT of some sort to netlink in
> addition to /proc/net/tcp. That's easy to do.
> 

I suggest adding a getsockopt() or something to gather stats for one
socket. On a loaded machine, /proc/net/tcp is damn slow.

We have TCP_INFO, we could add TCP_INFO_EXT, but taking care of choosing
an interface allowing for extension of the structure.




^ permalink raw reply

* Re: [PATCH] Add useful per-connection TCP stats for diagnosis purpose.
From: David Miller @ 2011-03-18  4:51 UTC (permalink / raw)
  To: hkchu; +Cc: shemminger, eric.dumazet, netdev
In-Reply-To: <AANLkTi=W-=8zhQpfJZ=DrDyUCwrT==5JkwRBiHaDkVXK@mail.gmail.com>

From: Jerry Chu <hkchu@google.com>
Date: Thu, 17 Mar 2011 21:33:50 -0700

> Yes I'm familiar with ss and how inet_csk_diag_fill() calls into
> tcp_diag_get_info(),..., etc. Like I mentioned previously the netlink
> interface
> requires a new version of reader app (e.g., ss) to ship every time a new
> counter is added and exported by the kernel, whereas /proc/net/tcp does
> not have such a problem.

You can add new netlink attributes to portably extend the existing
info, and also to add a mechanism by which to make 'ss' utility
upgrades unnecessary.

Please, just use modern mechanisms like netlink and leave legacy
bits like /proc/net/tcp alone, thank you.

^ permalink raw reply

* Re: [PATCH] Add useful per-connection TCP stats for diagnosis purpose.
From: Jerry Chu @ 2011-03-18  4:33 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Eric Dumazet, netdev
In-Reply-To: <20110317142030.62af785a@nehalam>

On Thu, Mar 17, 2011 at 2:20 PM, Stephen Hemminger
<shemminger@vyatta.com> wrote:
> On Thu, 17 Mar 2011 13:16:15 -0700
> Jerry Chu <hkchu@google.com> wrote:
>
>> Eric, thanks for the prompt feedback.
>>
>> On Thu, Mar 17, 2011 at 1:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > Le jeudi 17 mars 2011 à 01:06 -0700, H.K. Jerry Chu a écrit :
>> >> From: Jerry Chu <hkchu@google.com>
>> >>
>> >> This patch add a number of very useful counters/stats (defined in
>> >> tcp_stats.h) to help diagnosing TCP related problems.
>> >>
>> >> create_time     - when the connection was created (in jiffies)
>> >> total_inbytes   - total inbytes as consumed by the receiving apps.
>> >> total_outbytes  - total outbytes sent down from the transmitting apps.
>> >>
>> >> total_outdatasegs - total data carrying segments sent so far, including
>> >>               retransmitted ones.
>> >>
>> >> total_xmit      - total accumulated time (usecs) when the connection
>> >>               has something to send.
>> >>
>> >> total_retrans_time - total time (usecs, accumulated) the connection
>> >>               spends trying to recover lost packets. For each
>> >>               loss event the time is measured from the lost packet
>> >>               was first sent till the retransmitted packet was
>> >>               eventually ack'ed.
>> >>
>> >> total_cwnd_limit - total time (usecs, excluding time spent on loss
>> >>               recovery) the xmit is stopped due to cwnd limited
>> >>
>> >> total_swnd_limit - total time (usecs) theconnection is swnd limited
>> >>
>> >> The following two counters are for listeners only:
>> >>
>> >> accepted_reqs   - total # of accepted connection requests.
>> >> listen_drops    - total # of dropped SYN reqs (SYN cookies excluded) due
>> >>               to listener's queue overflow.
>> >>
>> >> total_retrans_time/total_retrans ratio gives a rough picture of how
>> >> quickly in average the connection can recover from a pkt loss. E.g.,
>> >> when the network is more congested, or the traffic contains mainly
>> >> smaller RPC where tail drop often requires RTO to recover,
>> >> the total_retrans_time/total_retrans ratio tends to be higher.
>> >>
>> >> Currently the new counters/stats are exported through /proc/net/tcp.
>> >
>> > Please dont. Use iproute2 instead.
>> >
>> >> Some simple, abbreviated field names have been added to the output of
>> >> /proc/net/tcp in order to allow backward/forward compatibility in the
>> >> future. Obviously the new counters/stats can also be easily exported
>> >> through other APIs.
>> >>
>> >
>> > /proc/net/tcp is legacy. You should touch it eventually, but after
>> > "other APIS" are done. It was the old way (quick but a bit ugly)
>>
>> Understood. /proc/net/tcp is a much more expedient way of exporting these
>> counters because it doesn't requires any additional, special tool to read it,
>> unless other APIs (e.g., netlink). Note that backward compatibility to
>> /proc/net/tcp has been ensured by adding field names in the heading.
>>
>> >
>> >
>> >
>> >> Signed-off-by: H.K. Jerry Chu <hkchu@google.com>
>> >> ---
>> >>  include/linux/ktime.h    |    3 ++
>> >>  include/linux/tcp.h      |    1 +
>> >>  include/net/tcp_stats.h  |   65 ++++++++++++++++++++++++++++++++++++++++++++++
>> >>  net/ipv4/tcp.c           |   30 ++++++++++++++++++---
>> >>  net/ipv4/tcp_input.c     |   13 +++++++++
>> >>  net/ipv4/tcp_ipv4.c      |   41 ++++++++++++++++++++++++++---
>> >>  net/ipv4/tcp_minisocks.c |    9 ++++++
>> >>  net/ipv4/tcp_output.c    |   47 +++++++++++++++++++++++++++++++--
>> >>  net/ipv6/tcp_ipv6.c      |    8 +++++
>> >>  9 files changed, 206 insertions(+), 11 deletions(-)
>> >>  create mode 100644 include/net/tcp_stats.h
>> >>
>> >> diff --git a/include/linux/ktime.h b/include/linux/ktime.h
>> >> index e1ceaa9..e60e758 100644
>> >> --- a/include/linux/ktime.h
>> >> +++ b/include/linux/ktime.h
>> >> @@ -333,6 +333,9 @@ extern void ktime_get_ts(struct timespec *ts);
>> >>  /* Get the real (wall-) time in timespec format: */
>> >>  #define ktime_get_real_ts(ts)        getnstimeofday(ts)
>> >
>> > Hmm, this kind of changes are out of netdev scope and should be avoided
>>
>> Ok. (It was moved out of tcp_stats.h only at the last minute.)
>>
>> >
>> >>
>> >> +#define ktime_since(a)               ktime_to_us(ktime_sub(ktime_get(), (a)))
>> >
>> > us are implied in ktime_since() ? thats strange.
>>
>> Ok.
>>
>> >
>> >> +#define ktime_zero(a)                ktime_equal((a), ktime_set(0, 0))
>> >
>> > ktime_zero() sounds like : "give me zero time" or "clear the ktime
>> > field".
>>
>> Yes I actually have been flip-flopping on the name...
>>
>> >
>> >> +
>> >>  static inline ktime_t ns_to_ktime(u64 ns)
>> >>  {
>> >>       static const ktime_t ktime_zero = { .tv64 = 0 };
>> >> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
>> >> index e64f4c6..ea5cb5d 100644
>> >> --- a/include/linux/tcp.h
>> >> +++ b/include/linux/tcp.h
>> >> @@ -460,6 +460,7 @@ struct tcp_sock {
>> >>        * contains related tcp_cookie_transactions fields.
>> >>        */
>> >>       struct tcp_cookie_values  *cookie_values;
>> >> +     struct tcp_stats        *conn_stats;
>> >>  };
>> >
>> > Really, using separate cache lines to store some stats is expensive.
>> > You should add counters in existing structure, to avoid additional cache
>> > line dirties. Carefully placing stats in already dirtied cache lines.
>>
>> This was how it was done initially but then we wanted to allow future
>> extension to include possibly a lot more counters, something like Web100
>> (RFC4898). For the latter the memory/performance hit will likely require
>> a config option, and a separate structure will make this easier. Does it
>> make sense?
>>
>> >
>> > You also should use native ktime_t infrastructure, to make the maths
>> > really fast in fast path.
>> >
>> > Only when stats are to be returned to user, you'll have to convert the
>> > native timestamps to user exportable ones.
>>
>> Good point! Will do. (I mistakenly thought ktime_t is a larger structure.)
>>
>> >
>> > Quite frankly, using u64 fields allow nanosec resolution.
>>
>> I wish to use less bits because the final report only needs ms or even
>> sec resolution but the intermediate computation needs to capture usec
>> resolution.
>>
>> >
>> > BTW, we probably could 'export' sk->sk_drops for TCP, like we do for
>> > UDP.
>>
>> There are many other potentially useful counters/stats (spurious_retrans,
>> min_rtt, total_rto,...) but there is a tradeoff against memory/performance hit
>> so for the first round I'm focusing on what i feel is the most useful set.
>>
>> Thanks,
>>
>> Jerry
>
> These stats are best added via netlink, the tool ss already prints lots
> of similar stats. Look at INET_DIAG_INFO and the output of:
>  ss -i -t

Yes I'm familiar with ss and how inet_csk_diag_fill() calls into
tcp_diag_get_info(),..., etc. Like I mentioned previously the netlink
interface
requires a new version of reader app (e.g., ss) to ship every time a new
counter is added and exported by the kernel, whereas /proc/net/tcp does
not have such a problem.

Anyway I can add a INET_DIAG_INFO_EXT of some sort to netlink in
addition to /proc/net/tcp. That's easy to do.

Thanks,

Jerry

>
>
>
>
>
>
> --
>

^ permalink raw reply

* [PATCH 36/36] net,rcu: convert call_rcu(xt_osf_finger_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:15 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Patrick McHardy, David S. Miller,
	netfilter-devel



The rcu callback xt_osf_finger_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(xt_osf_finger_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/netfilter/xt_osf.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
index 4327e10..846f895 100644
--- a/net/netfilter/xt_osf.c
+++ b/net/netfilter/xt_osf.c
@@ -62,13 +62,6 @@ static const struct nla_policy xt_osf_policy[OSF_ATTR_MAX + 1] = {
 	[OSF_ATTR_FINGER]	= { .len = sizeof(struct xt_osf_user_finger) },
 };
 
-static void xt_osf_finger_free_rcu(struct rcu_head *rcu_head)
-{
-	struct xt_osf_finger *f = container_of(rcu_head, struct xt_osf_finger, rcu_head);
-
-	kfree(f);
-}
-
 static int xt_osf_add_callback(struct sock *ctnl, struct sk_buff *skb,
 			       const struct nlmsghdr *nlh,
 			       const struct nlattr * const osf_attrs[])
@@ -133,7 +126,7 @@ static int xt_osf_remove_callback(struct sock *ctnl, struct sk_buff *skb,
 		 * We are protected by nfnl mutex.
 		 */
 		list_del_rcu(&sf->finger_entry);
-		call_rcu(&sf->rcu_head, xt_osf_finger_free_rcu);
+		kfree_rcu(sf, rcu_head);
 
 		err = 0;
 		break;
@@ -414,7 +407,7 @@ static void __exit xt_osf_fini(void)
 
 		list_for_each_entry_rcu(f, &xt_osf_fingers[i], finger_entry) {
 			list_del_rcu(&f->finger_entry);
-			call_rcu(&f->rcu_head, xt_osf_finger_free_rcu);
+			kfree_rcu(f, rcu_head);
 		}
 	}
 	rcu_read_unlock();
-- 
1.7.4

^ permalink raw reply related

* [PATCH 35/36] net/mac80211,rcu: convert call_rcu(work_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:14 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Johannes Berg, John W. Linville,
	"David S. Miller



The rcu callback work_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(work_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/mac80211/work.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 36305e0..dcc433e 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -66,17 +66,9 @@ static void run_again(struct ieee80211_local *local,
 		mod_timer(&local->work_timer, timeout);
 }
 
-static void work_free_rcu(struct rcu_head *head)
-{
-	struct ieee80211_work *wk =
-		container_of(head, struct ieee80211_work, rcu_head);
-
-	kfree(wk);
-}
-
 void free_work(struct ieee80211_work *wk)
 {
-	call_rcu(&wk->rcu_head, work_free_rcu);
+	kfree_rcu(wk, rcu_head);
 }
 
 static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
-- 
1.7.4

^ permalink raw reply related

* [PATCH 30/36] net,rcu: convert call_rcu(wq_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:10 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, netdev,
	linux-kernel



The rcu callback wq_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(wq_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/socket.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index ac2219f..3158271 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -261,21 +261,12 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
 	return &ei->vfs_inode;
 }
 
-
-
-static void wq_free_rcu(struct rcu_head *head)
-{
-	struct socket_wq *wq = container_of(head, struct socket_wq, rcu);
-
-	kfree(wq);
-}
-
 static void sock_destroy_inode(struct inode *inode)
 {
 	struct socket_alloc *ei;
 
 	ei = container_of(inode, struct socket_alloc, vfs_inode);
-	call_rcu(&ei->socket.wq->rcu, wq_free_rcu);
+	kfree_rcu(ei->socket.wq, rcu);
 	kmem_cache_free(sock_inode_cachep, ei);
 }
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 28/36] net,rcu: convert call_rcu(phonet_device_rcu_free) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:09 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Remi Denis-Courmont,
	David S. Miller, netdev



The rcu callback phonet_device_rcu_free() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(phonet_device_rcu_free).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/phonet/pn_dev.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 947038d..1566672 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -162,14 +162,6 @@ int phonet_address_add(struct net_device *dev, u8 addr)
 	return err;
 }
 
-static void phonet_device_rcu_free(struct rcu_head *head)
-{
-	struct phonet_device *pnd;
-
-	pnd = container_of(head, struct phonet_device, rcu);
-	kfree(pnd);
-}
-
 int phonet_address_del(struct net_device *dev, u8 addr)
 {
 	struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
@@ -188,7 +180,7 @@ int phonet_address_del(struct net_device *dev, u8 addr)
 	mutex_unlock(&pndevs->lock);
 
 	if (pnd)
-		call_rcu(&pnd->rcu, phonet_device_rcu_free);
+		kfree_rcu(pnd, rcu);
 
 	return err;
 }
-- 
1.7.4

^ permalink raw reply related

* Re: sctp panic
From: Wei Yongjun @ 2011-03-18  4:06 UTC (permalink / raw)
  To: richard -rw- weinberger; +Cc: walter schloegl, linux-kernel, netdev
In-Reply-To: <AANLkTi=yN2MtaOwUQsKmYaYxfkc0+mKtZiDeJ=r-KACK@mail.gmail.com>



> On Thu, Mar 17, 2011 at 11:49 AM, walter schloegl <sctp@muskelshirt.de> wrote:
>> -------- Original-Nachricht --------
>>> Datum: Thu, 17 Mar 2011 08:56:47 +0100
>>> Von: richard -rw- weinberger <richard.weinberger@gmail.com>
>>> An: sctp@muskelshirt.de
>>> CC: linux-kernel@vger.kernel.org
>>> Betreff: Re: sctp panic
>>> On Thu, Mar 17, 2011 at 8:43 AM,  <sctp@muskelshirt.de> wrote:
>>>> Hi
>>>>
>>>> when doing the actions below I get a panic.
>>>>
>>>> - echo 1 > /proc/sys/net/sctp/addip_enable
>>>> - In a C-Programm
>>>>    - socket(AF_INET,SOCK_STREAM,IPPROTO_SCTP);
>>>>    - connect(....)     (with correct filled parameters)
>>>>
>>>> Its no process (waiting in accept) neccessary
>>> Can you show us the panic message and your C prorgam?
>>> This would help reproducing the panic...
>> ...snip...
>>
>> The crash says:
>>
>> crash> bt
>> PID: 14646  TASK: ffff8801f40c7560  CPU: 9   COMMAND: "x"
>>  #0 [ffff8801f6f5f6f0] machine_kexec at ffffffff8103697b
>>  #1 [ffff8801f6f5f750] crash_kexec at ffffffff810b9078
>>  #2 [ffff8801f6f5f820] oops_end at ffffffff814cc900
>>  #3 [ffff8801f6f5f850] die at ffffffff8101733b
>>  #4 [ffff8801f6f5f880] do_trap at ffffffff814cc1d4
>>  #5 [ffff8801f6f5f8e0] do_invalid_op at ffffffff81014ee5
>>  #6 [ffff8801f6f5f980] invalid_op at ffffffff81013f5b
>>    [exception RIP: skb_over_panic+93]
>>    RIP: ffffffff81404bdd  RSP: ffff8801f6f5fa38  RFLAGS: 00010296
>>    RAX: 0000000000000083  RBX: 0000000000000040  RCX: 00000000000013f6
>>    RDX: 0000000000000000  RSI: 0000000000000046  RDI: 0000000000000246
>>    RBP: ffff8801f6f5fa58   R8: ffffffff818a3da0   R9: 0000000000000000
>>    R10: 0000000000000001  R11: 0000000000000000  R12: ffff8801f4e11000
>>    R13: 0000000000000004  R14: 000000000000003e  R15: 0000000000000001
>>    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
>>  #7 [ffff8801f6f5fa60] skb_put at ffffffff81405c1c
>>  #8 [ffff8801f6f5fa80] sctp_addto_chunk at ffffffffa0503c23
>>  #9 [ffff8801f6f5fad0] sctp_make_init at ffffffffa0506705
>> #10 [ffff8801f6f5fba0] sctp_sf_do_prm_asoc at ffffffffa04f81d4
>> #11 [ffff8801f6f5fbd0] sctp_do_sm at ffffffffa04fd381
>> #12 [ffff8801f6f5fd60] sctp_primitive_ASSOCIATE at ffffffffa0513daf
>> #13 [ffff8801f6f5fd80] __sctp_connect at ffffffffa0510f09
>> #14 [ffff8801f6f5fe50] sctp_connect at ffffffffa0511248
>> #15 [ffff8801f6f5fe80] inet_dgram_connect at ffffffff81471b6c
>> #16 [ffff8801f6f5feb0] sys_connect at ffffffff813ff747
>> #17 [ffff8801f6f5ff80] system_call_fastpath at ffffffff81013172
>>    RIP: 0000003015ee2150  RSP: 00007fffea7bdce8  RFLAGS: 00010206
>>    RAX: 000000000000002a  RBX: ffffffff81013172  RCX: 0000000000000000
>>    RDX: 0000000000000010  RSI: 00007fffea7bdd00  RDI: 0000000000000003
>>    RBP: 00007fffea7bdd40   R8: 0000000000759020   R9: ff00000000000000
>>    R10: 00007fffea7bda70  R11: 0000000000000246  R12: 0000000000000000
>>    R13: 00007fffea7bde20  R14: 00000000004006e0  R15: 0000000000000000
>>    ORIG_RAX: 000000000000002a  CS: 0033  SS: 002b
>>
>>
>>

Are you using old kernel? If it is, the following patch may fixed this
issue.

http://git.kernel.org/?p=linux/kernel/git/vxy/lksctp-dev.git;a=commitdiff;h=a8170c35e738d62e9919ce5b109cf4ed66e95bde;hp=81419d862db743fe4450a021893f24bab4698c1d

>>>> br
>>>> walter
>>>> --
>>>> GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
>>>> gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
>>> in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>> Please read the FAQ at  http://www.tux.org/lkml/
>>>>
>>> --
>>> Thanks,
>>> //richard
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
>> --
>> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
>> Jetzt informieren: http://www.gmx.net/de/go/freephone
>>
> CC'ing netdev
>

^ permalink raw reply

* [PATCH 25/36] net,rcu: convert call_rcu(__nf_ct_ext_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:07 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Patrick McHardy, David S. Miller,
	netfilter-devel



The rcu callback __nf_ct_ext_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(__nf_ct_ext_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/netfilter/nf_conntrack_extend.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index bd82450..cc0bcda 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -68,12 +68,6 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
 	return (void *)(*ext) + off;
 }
 
-static void __nf_ct_ext_free_rcu(struct rcu_head *head)
-{
-	struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu);
-	kfree(ext);
-}
-
 void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
 {
 	struct nf_ct_ext *old, *new;
@@ -114,7 +108,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
 					(void *)old + old->offset[i]);
 			rcu_read_unlock();
 		}
-		call_rcu(&old->rcu, __nf_ct_ext_free_rcu);
+		kfree_rcu(old, rcu);
 		ct->ext = new;
 	}
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 24/36] net,rcu: convert call_rcu(net_generic_release) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:06 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, Jiri Pirko,
	Eric Dumazet



The rcu callback net_generic_release() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(net_generic_release).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/net_namespace.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3f86026..297bb92 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -27,14 +27,6 @@ EXPORT_SYMBOL(init_net);
 
 #define INITIAL_NET_GEN_PTRS	13 /* +1 for len +2 for rcu_head */
 
-static void net_generic_release(struct rcu_head *rcu)
-{
-	struct net_generic *ng;
-
-	ng = container_of(rcu, struct net_generic, rcu);
-	kfree(ng);
-}
-
 static int net_assign_generic(struct net *net, int id, void *data)
 {
 	struct net_generic *ng, *old_ng;
@@ -68,7 +60,7 @@ static int net_assign_generic(struct net *net, int id, void *data)
 	memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*));
 
 	rcu_assign_pointer(net->gen, ng);
-	call_rcu(&old_ng->rcu, net_generic_release);
+	kfree_rcu(old_ng, rcu);
 assign:
 	ng->ptr[id - 1] = data;
 	return 0;
-- 
1.7.4

^ permalink raw reply related

* [PATCH 20/36] net,rcu: convert call_rcu(netlbl_unlhsh_free_addr4) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:03 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Paul Moore, David S. Miller,
	netdev, linux-ke



The rcu callback netlbl_unlhsh_free_addr4() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(netlbl_unlhsh_free_addr4).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/netlabel/netlabel_unlabeled.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index e2b0a68..4e5ad90 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -153,24 +153,6 @@ static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1
  * Unlabeled Connection Hash Table Functions
  */
 
-/**
- * netlbl_unlhsh_free_addr4 - Frees an IPv4 address entry from the hash table
- * @entry: the entry's RCU field
- *
- * Description:
- * This function is designed to be used as a callback to the call_rcu()
- * function so that memory allocated to a hash table address entry can be
- * released safely.
- *
- */
-static void netlbl_unlhsh_free_addr4(struct rcu_head *entry)
-{
-	struct netlbl_unlhsh_addr4 *ptr;
-
-	ptr = container_of(entry, struct netlbl_unlhsh_addr4, rcu);
-	kfree(ptr);
-}
-
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 /**
  * netlbl_unlhsh_free_addr6 - Frees an IPv6 address entry from the hash table
@@ -568,7 +550,7 @@ static int netlbl_unlhsh_remove_addr4(struct net *net,
 	if (entry == NULL)
 		return -ENOENT;
 
-	call_rcu(&entry->rcu, netlbl_unlhsh_free_addr4);
+	kfree_rcu(entry, rcu);
 	return 0;
 }
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 21/36] net,rcu: convert call_rcu(netlbl_unlhsh_free_addr6) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:04 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Paul Moore, David S. Miller,
	netdev, linux-ke



The rcu callback netlbl_unlhsh_free_addr6() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(netlbl_unlhsh_free_addr6).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/netlabel/netlabel_unlabeled.c |   22 +---------------------
 1 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 4e5ad90..9c38658 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -153,26 +153,6 @@ static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1
  * Unlabeled Connection Hash Table Functions
  */
 
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-/**
- * netlbl_unlhsh_free_addr6 - Frees an IPv6 address entry from the hash table
- * @entry: the entry's RCU field
- *
- * Description:
- * This function is designed to be used as a callback to the call_rcu()
- * function so that memory allocated to a hash table address entry can be
- * released safely.
- *
- */
-static void netlbl_unlhsh_free_addr6(struct rcu_head *entry)
-{
-	struct netlbl_unlhsh_addr6 *ptr;
-
-	ptr = container_of(entry, struct netlbl_unlhsh_addr6, rcu);
-	kfree(ptr);
-}
-#endif /* IPv6 */
-
 /**
  * netlbl_unlhsh_free_iface - Frees an interface entry from the hash table
  * @entry: the entry's RCU field
@@ -611,7 +591,7 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
 	if (entry == NULL)
 		return -ENOENT;
 
-	call_rcu(&entry->rcu, netlbl_unlhsh_free_addr6);
+	kfree_rcu(entry, rcu);
 	return 0;
 }
 #endif /* IPv6 */
-- 
1.7.4

^ permalink raw reply related

* [PATCH 18/36] net,rcu: convert call_rcu(xps_dev_maps_release) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:02 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, Eric Dumazet,
	Tom Herbert



The rcu callback xps_dev_maps_release() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(xps_dev_maps_release).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/net-sysfs.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 9ae2e1d..06332e5 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -876,14 +876,6 @@ static ssize_t show_xps_map(struct netdev_queue *queue,
 	return len;
 }
 
-static void xps_dev_maps_release(struct rcu_head *rcu)
-{
-	struct xps_dev_maps *dev_maps =
-	    container_of(rcu, struct xps_dev_maps, rcu);
-
-	kfree(dev_maps);
-}
-
 static DEFINE_MUTEX(xps_map_mutex);
 #define xmap_dereference(P)		\
 	rcu_dereference_protected((P), lockdep_is_held(&xps_map_mutex))
@@ -993,7 +985,7 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
 	}
 
 	if (dev_maps)
-		call_rcu(&dev_maps->rcu, xps_dev_maps_release);
+		kfree_rcu(dev_maps, rcu);
 
 	netdev_queue_numa_node_write(queue, (numa_node >= 0) ? numa_node :
 					    NUMA_NO_NODE);
@@ -1065,7 +1057,7 @@ static void netdev_queue_release(struct kobject *kobj)
 
 		if (!nonempty) {
 			RCU_INIT_POINTER(dev->xps_maps, NULL);
-			call_rcu(&dev_maps->rcu, xps_dev_maps_release);
+			kfree_rcu(dev_maps, rcu);
 		}
 	}
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 17/36] net,rcu: convert call_rcu(xps_map_release) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:02 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, Eric Dumazet,
	Tom Herbert



The rcu callback xps_map_release() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(xps_map_release).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/net-sysfs.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 21e9208..9ae2e1d 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -876,13 +876,6 @@ static ssize_t show_xps_map(struct netdev_queue *queue,
 	return len;
 }
 
-static void xps_map_release(struct rcu_head *rcu)
-{
-	struct xps_map *map = container_of(rcu, struct xps_map, rcu);
-
-	kfree(map);
-}
-
 static void xps_dev_maps_release(struct rcu_head *rcu)
 {
 	struct xps_dev_maps *dev_maps =
@@ -987,7 +980,7 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
 		map = dev_maps ?
 			xmap_dereference(dev_maps->cpu_map[cpu]) : NULL;
 		if (map && xmap_dereference(new_dev_maps->cpu_map[cpu]) != map)
-			call_rcu(&map->rcu, xps_map_release);
+			kfree_rcu(map, rcu);
 		if (new_dev_maps->cpu_map[cpu])
 			nonempty = 1;
 	}
@@ -1062,7 +1055,7 @@ static void netdev_queue_release(struct kobject *kobj)
 				else {
 					RCU_INIT_POINTER(dev_maps->cpu_map[i],
 					    NULL);
-					call_rcu(&map->rcu, xps_map_release);
+					kfree_rcu(map, rcu);
 					map = NULL;
 				}
 			}
-- 
1.7.4

^ permalink raw reply related

* [PATCH 16/36] net,rcu: convert call_rcu(rps_map_release) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:01 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, Eric Dumazet,
	Tom Herbert



The rcu callback rps_map_release() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(rps_map_release).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/net-sysfs.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index e23c01b..21e9208 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -550,13 +550,6 @@ static ssize_t show_rps_map(struct netdev_rx_queue *queue,
 	return len;
 }
 
-static void rps_map_release(struct rcu_head *rcu)
-{
-	struct rps_map *map = container_of(rcu, struct rps_map, rcu);
-
-	kfree(map);
-}
-
 static ssize_t store_rps_map(struct netdev_rx_queue *queue,
 		      struct rx_queue_attribute *attribute,
 		      const char *buf, size_t len)
@@ -604,7 +597,7 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
 	spin_unlock(&rps_map_lock);
 
 	if (old_map)
-		call_rcu(&old_map->rcu, rps_map_release);
+		kfree_rcu(old_map, rcu);
 
 	free_cpumask_var(mask);
 	return len;
@@ -713,7 +706,7 @@ static void rx_queue_release(struct kobject *kobj)
 	map = rcu_dereference_raw(queue->rps_map);
 	if (map) {
 		RCU_INIT_POINTER(queue->rps_map, NULL);
-		call_rcu(&map->rcu, rps_map_release);
+		kfree_rcu(map, rcu);
 	}
 
 	flow_table = rcu_dereference_raw(queue->rps_flow_table);
-- 
1.7.4

^ permalink raw reply related

* [PATCH 15/36] net,rcu: convert call_rcu(ipv6_mc_socklist_reclaim) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:00 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, David S. Miller, Alexey Kuznetsov,
	"Pekka Savola (ipv6)"



The rcu callback ipv6_mc_socklist_reclaim() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ipv6_mc_socklist_reclaim).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv6/mcast.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 49f986d..7f8df31 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -201,10 +201,6 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
 	return 0;
 }
 
-static void ipv6_mc_socklist_reclaim(struct rcu_head *head)
-{
-	kfree(container_of(head, struct ipv6_mc_socklist, rcu));
-}
 /*
  *	socket leave on multicast group
  */
@@ -239,7 +235,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
 				(void) ip6_mc_leave_src(sk, mc_lst, NULL);
 			rcu_read_unlock();
 			atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc);
-			call_rcu(&mc_lst->rcu, ipv6_mc_socklist_reclaim);
+			kfree_rcu(mc_lst, rcu);
 			return 0;
 		}
 	}
@@ -307,7 +303,7 @@ void ipv6_sock_mc_close(struct sock *sk)
 		rcu_read_unlock();
 
 		atomic_sub(sizeof(*mc_lst), &sk->sk_omem_alloc);
-		call_rcu(&mc_lst->rcu, ipv6_mc_socklist_reclaim);
+		kfree_rcu(mc_lst, rcu);
 
 		spin_lock(&ipv6_sk_mc_lock);
 	}
-- 
1.7.4

^ permalink raw reply related

* [PATCH 14/36] macvlan,rcu: convert call_rcu(macvlan_port_rcu_free) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  4:00 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Patrick McHardy, netdev,
	linux-kernel



The rcu callback macvlan_port_rcu_free() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(macvlan_port_rcu_free).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 drivers/net/macvlan.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ed577b..6205e45 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -591,21 +591,13 @@ static int macvlan_port_create(struct net_device *dev)
 	return err;
 }
 
-static void macvlan_port_rcu_free(struct rcu_head *head)
-{
-	struct macvlan_port *port;
-
-	port = container_of(head, struct macvlan_port, rcu);
-	kfree(port);
-}
-
 static void macvlan_port_destroy(struct net_device *dev)
 {
 	struct macvlan_port *port = macvlan_port_get(dev);
 
 	dev->priv_flags &= ~IFF_MACVLAN_PORT;
 	netdev_rx_handler_unregister(dev);
-	call_rcu(&port->rcu, macvlan_port_rcu_free);
+	kfree_rcu(port, rcu);
 }
 
 static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
-- 
1.7.4

^ permalink raw reply related

* [PATCH 11/36] ixgbe,rcu: convert call_rcu(ring_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:57 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jeff Kirsher, Jesse Brandeburg,
	Bruce Allan <



The rcu callback ring_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ring_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 drivers/net/ixgbe/ixgbe_main.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 30f9ccf..3e7fff5 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5003,11 +5003,6 @@ err_set_interrupt:
 	return err;
 }
 
-static void ring_free_rcu(struct rcu_head *head)
-{
-	kfree(container_of(head, struct ixgbe_ring, rcu));
-}
-
 /**
  * ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings
  * @adapter: board private structure to clear interrupt scheme on
@@ -5029,7 +5024,7 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
 		/* ixgbe_get_stats64() might access this ring, we must wait
 		 * a grace period before freeing it.
 		 */
-		call_rcu(&ring->rcu, ring_free_rcu);
+		kfree_rcu(ring, rcu);
 		adapter->rx_ring[i] = NULL;
 	}
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 09/36] net,rcu: convert call_rcu(ip_mc_socklist_reclaim) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:45 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback ip_mc_socklist_reclaim() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ip_mc_socklist_reclaim).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/igmp.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index cf98a36..998dff0 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1850,14 +1850,6 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
 	return err;
 }
 
-
-static void ip_mc_socklist_reclaim(struct rcu_head *rp)
-{
-	kfree(container_of(rp, struct ip_mc_socklist, rcu));
-	/* sk_omem_alloc should have been decreased by the caller*/
-}
-
-
 /*
  *	Ask a socket to leave a group.
  */
@@ -1897,7 +1889,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
 		rtnl_unlock();
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
-		call_rcu(&iml->rcu, ip_mc_socklist_reclaim);
+		kfree_rcu(iml, rcu);
 		return 0;
 	}
 	if (!in_dev)
@@ -2312,7 +2304,7 @@ void ip_mc_drop_socket(struct sock *sk)
 			ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr);
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
-		call_rcu(&iml->rcu, ip_mc_socklist_reclaim);
+		kfree_rcu(iml, rcu);
 	}
 	rtnl_unlock();
 }
-- 
1.7.4

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox