* Re: [RFC patch net-next-2.6] net: introduce ethernet teaming device
From: Jiri Pirko @ 2011-10-03 11:37 UTC (permalink / raw)
To: Jesse Gross
Cc: netdev, davem, eric.dumazet, bhutchings, shemminger, fubar, andy,
tgraf, ebiederm, mirqus, kaber, greearb
In-Reply-To: <CAEP_g=8uJnngfKJRGLLnd8U7M9aJTfOSUheB62-O7OX6Ud0DLw@mail.gmail.com>
Sat, Oct 01, 2011 at 08:15:01PM CEST, jesse@nicira.com wrote:
>On Fri, Sep 30, 2011 at 5:44 AM, Jiri Pirko <jpirko@redhat.com> wrote:
>> This patch introduces new network device called team. It supposes to be
>> very fast, simple, userspace-driven parallel to existing bonding device.
>> Userspace library called libteam with couple of demo apps is available
>> here:
>> https://github.com/jpirko/libteam
>> Note it's still in its dipers atm.
>>
>> team<->libteam use generic netlink for communication. That and rtnl
>> suppose to be the only way to configure team device, no sysfs etc.
>>
>> In near future python binding for libteam will be introduced. Also
>> daemon providing arpmon/miimon active-backup functionality will
>> be introduced. All what's necessary is already implemented in kernel team
>> driver.
>>
>> Plan is to support 8023ad in near future with it's logic mainly in
>> userspace daemon as well.
>>
>> Please review, try, comment. All feedback would be much appreciated.
>>
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>
>Not to push my own agenda too much but you might want to take a look
>at Open vSwitch. It uses the same strategy of userspace directed
>bonding and already supports active-backup, 802.3ad, and quite a few
>other networking tools all controlled by userspace.
>
>I know there's been a lot of talk and not a lot of action when it
>comes to upstreaming but that's changing. We're fixing up a few loose
>ends in the userspace/kernel interface and then intend to propose a
>patch fairly soon.
Looks interesting. From quick peak the code is much bigger and fairly
complicated. The main reason for doing "team" is to do ethernet teaming
in as much simple way as it can be done. Final user destination areas
of openvswitch and team seem different to me.
Jirka
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Kirill A. Shutemov @ 2011-10-03 12:14 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <1317637123-18306-8-git-send-email-glommer@parallels.com>
On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
> This patch introduces kmem.tcp_current_memory file, living in the
> kmem_cgroup filesystem. It is a simple read-only file that displays the
> amount of kernel memory currently consumed by the cgroup.
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
> ---
> Documentation/cgroups/memory.txt | 1 +
> mm/memcontrol.c | 11 +++++++++++
> 2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> index 1ffde3e..f5a539d 100644
> --- a/Documentation/cgroups/memory.txt
> +++ b/Documentation/cgroups/memory.txt
> @@ -79,6 +79,7 @@ Brief summary of control files.
> memory.independent_kmem_limit # select whether or not kernel memory limits are
> independent of user limits
> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
Both are in pages, right?
Shouldn't it be scaled to bytes and named uniform with other memcg file?
memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Glauber Costa @ 2011-10-03 12:19 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <20111003121446.GD29312@shutemov.name>
On 10/03/2011 04:14 PM, Kirill A. Shutemov wrote:
> On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
>> This patch introduces kmem.tcp_current_memory file, living in the
>> kmem_cgroup filesystem. It is a simple read-only file that displays the
>> amount of kernel memory currently consumed by the cgroup.
>>
>> Signed-off-by: Glauber Costa<glommer@parallels.com>
>> CC: David S. Miller<davem@davemloft.net>
>> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
>> CC: Eric W. Biederman<ebiederm@xmission.com>
>> ---
>> Documentation/cgroups/memory.txt | 1 +
>> mm/memcontrol.c | 11 +++++++++++
>> 2 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
>> index 1ffde3e..f5a539d 100644
>> --- a/Documentation/cgroups/memory.txt
>> +++ b/Documentation/cgroups/memory.txt
>> @@ -79,6 +79,7 @@ Brief summary of control files.
>> memory.independent_kmem_limit # select whether or not kernel memory limits are
>> independent of user limits
>> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
>> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
>
> Both are in pages, right?
> Shouldn't it be scaled to bytes and named uniform with other memcg file?
> memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
>
You are absolutely correct.
Since the internal tcp comparison works, I just ended up never noticing
this.
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Kirill A. Shutemov @ 2011-10-03 12:25 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <4E89A846.1010200@parallels.com>
On Mon, Oct 03, 2011 at 04:19:18PM +0400, Glauber Costa wrote:
> On 10/03/2011 04:14 PM, Kirill A. Shutemov wrote:
> > On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
> >> This patch introduces kmem.tcp_current_memory file, living in the
> >> kmem_cgroup filesystem. It is a simple read-only file that displays the
> >> amount of kernel memory currently consumed by the cgroup.
> >>
> >> Signed-off-by: Glauber Costa<glommer@parallels.com>
> >> CC: David S. Miller<davem@davemloft.net>
> >> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
> >> CC: Eric W. Biederman<ebiederm@xmission.com>
> >> ---
> >> Documentation/cgroups/memory.txt | 1 +
> >> mm/memcontrol.c | 11 +++++++++++
> >> 2 files changed, 12 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> >> index 1ffde3e..f5a539d 100644
> >> --- a/Documentation/cgroups/memory.txt
> >> +++ b/Documentation/cgroups/memory.txt
> >> @@ -79,6 +79,7 @@ Brief summary of control files.
> >> memory.independent_kmem_limit # select whether or not kernel memory limits are
> >> independent of user limits
> >> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
> >> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
> >
> > Both are in pages, right?
> > Shouldn't it be scaled to bytes and named uniform with other memcg file?
> > memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
> >
> You are absolutely correct.
> Since the internal tcp comparison works, I just ended up never noticing
> this.
Should we have failcnt and max_usage_in_bytes for tcp as well?
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Glauber Costa @ 2011-10-03 12:26 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <20111003122511.GA29982@shutemov.name>
On 10/03/2011 04:25 PM, Kirill A. Shutemov wrote:
> On Mon, Oct 03, 2011 at 04:19:18PM +0400, Glauber Costa wrote:
>> On 10/03/2011 04:14 PM, Kirill A. Shutemov wrote:
>>> On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
>>>> This patch introduces kmem.tcp_current_memory file, living in the
>>>> kmem_cgroup filesystem. It is a simple read-only file that displays the
>>>> amount of kernel memory currently consumed by the cgroup.
>>>>
>>>> Signed-off-by: Glauber Costa<glommer@parallels.com>
>>>> CC: David S. Miller<davem@davemloft.net>
>>>> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
>>>> CC: Eric W. Biederman<ebiederm@xmission.com>
>>>> ---
>>>> Documentation/cgroups/memory.txt | 1 +
>>>> mm/memcontrol.c | 11 +++++++++++
>>>> 2 files changed, 12 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
>>>> index 1ffde3e..f5a539d 100644
>>>> --- a/Documentation/cgroups/memory.txt
>>>> +++ b/Documentation/cgroups/memory.txt
>>>> @@ -79,6 +79,7 @@ Brief summary of control files.
>>>> memory.independent_kmem_limit # select whether or not kernel memory limits are
>>>> independent of user limits
>>>> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
>>>> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
>>>
>>> Both are in pages, right?
>>> Shouldn't it be scaled to bytes and named uniform with other memcg file?
>>> memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
>>>
>> You are absolutely correct.
>> Since the internal tcp comparison works, I just ended up never noticing
>> this.
>
> Should we have failcnt and max_usage_in_bytes for tcp as well?
>
Well, we get a fail count from the tracer anyway, so I don't really see
a need for that. I see value in having it for the slab allocation
itself, but since this only controls the memory pressure framework, I
think we can live without it.
That said, this is not a strong opinion. I can add it if you'd prefer.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Glauber Costa @ 2011-10-03 12:36 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <20111003123620.GA30018@shutemov.name>
On 10/03/2011 04:36 PM, Kirill A. Shutemov wrote:
> On Mon, Oct 03, 2011 at 04:26:41PM +0400, Glauber Costa wrote:
>> On 10/03/2011 04:25 PM, Kirill A. Shutemov wrote:
>>> On Mon, Oct 03, 2011 at 04:19:18PM +0400, Glauber Costa wrote:
>>>> On 10/03/2011 04:14 PM, Kirill A. Shutemov wrote:
>>>>> On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
>>>>>> This patch introduces kmem.tcp_current_memory file, living in the
>>>>>> kmem_cgroup filesystem. It is a simple read-only file that displays the
>>>>>> amount of kernel memory currently consumed by the cgroup.
>>>>>>
>>>>>> Signed-off-by: Glauber Costa<glommer@parallels.com>
>>>>>> CC: David S. Miller<davem@davemloft.net>
>>>>>> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
>>>>>> CC: Eric W. Biederman<ebiederm@xmission.com>
>>>>>> ---
>>>>>> Documentation/cgroups/memory.txt | 1 +
>>>>>> mm/memcontrol.c | 11 +++++++++++
>>>>>> 2 files changed, 12 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
>>>>>> index 1ffde3e..f5a539d 100644
>>>>>> --- a/Documentation/cgroups/memory.txt
>>>>>> +++ b/Documentation/cgroups/memory.txt
>>>>>> @@ -79,6 +79,7 @@ Brief summary of control files.
>>>>>> memory.independent_kmem_limit # select whether or not kernel memory limits are
>>>>>> independent of user limits
>>>>>> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
>>>>>> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
>>>>>
>>>>> Both are in pages, right?
>>>>> Shouldn't it be scaled to bytes and named uniform with other memcg file?
>>>>> memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
>>>>>
>>>> You are absolutely correct.
>>>> Since the internal tcp comparison works, I just ended up never noticing
>>>> this.
>>>
>>> Should we have failcnt and max_usage_in_bytes for tcp as well?
>>>
>>
>> Well, we get a fail count from the tracer anyway, so I don't really see
>> a need for that. I see value in having it for the slab allocation
>> itself, but since this only controls the memory pressure framework, I
>> think we can live without it.
>>
>> That said, this is not a strong opinion. I can add it if you'd prefer.
>
> It's good for userspace to have the same set of files for all domains:
> - memory;
> - memory.memsw;
> - memory.kmem;
> - memory.kmem.tcp;
> - etc.
> Userspace can reuse code for handling them in this case.
>
Fine.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH v4 7/8] Display current tcp memory allocation in kmem cgroup
From: Kirill A. Shutemov @ 2011-10-03 12:36 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, avagin
In-Reply-To: <4E89AA01.3000803@parallels.com>
On Mon, Oct 03, 2011 at 04:26:41PM +0400, Glauber Costa wrote:
> On 10/03/2011 04:25 PM, Kirill A. Shutemov wrote:
> > On Mon, Oct 03, 2011 at 04:19:18PM +0400, Glauber Costa wrote:
> >> On 10/03/2011 04:14 PM, Kirill A. Shutemov wrote:
> >>> On Mon, Oct 03, 2011 at 02:18:42PM +0400, Glauber Costa wrote:
> >>>> This patch introduces kmem.tcp_current_memory file, living in the
> >>>> kmem_cgroup filesystem. It is a simple read-only file that displays the
> >>>> amount of kernel memory currently consumed by the cgroup.
> >>>>
> >>>> Signed-off-by: Glauber Costa<glommer@parallels.com>
> >>>> CC: David S. Miller<davem@davemloft.net>
> >>>> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com>
> >>>> CC: Eric W. Biederman<ebiederm@xmission.com>
> >>>> ---
> >>>> Documentation/cgroups/memory.txt | 1 +
> >>>> mm/memcontrol.c | 11 +++++++++++
> >>>> 2 files changed, 12 insertions(+), 0 deletions(-)
> >>>>
> >>>> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> >>>> index 1ffde3e..f5a539d 100644
> >>>> --- a/Documentation/cgroups/memory.txt
> >>>> +++ b/Documentation/cgroups/memory.txt
> >>>> @@ -79,6 +79,7 @@ Brief summary of control files.
> >>>> memory.independent_kmem_limit # select whether or not kernel memory limits are
> >>>> independent of user limits
> >>>> memory.kmem.tcp.max_memory # set/show hard limit for tcp buf memory
> >>>> + memory.kmem.tcp.current_memory # show current tcp buf memory allocation
> >>>
> >>> Both are in pages, right?
> >>> Shouldn't it be scaled to bytes and named uniform with other memcg file?
> >>> memory.kmem.tcp.limit_in_bytes/usage_in_bytes.
> >>>
> >> You are absolutely correct.
> >> Since the internal tcp comparison works, I just ended up never noticing
> >> this.
> >
> > Should we have failcnt and max_usage_in_bytes for tcp as well?
> >
>
> Well, we get a fail count from the tracer anyway, so I don't really see
> a need for that. I see value in having it for the slab allocation
> itself, but since this only controls the memory pressure framework, I
> think we can live without it.
>
> That said, this is not a strong opinion. I can add it if you'd prefer.
It's good for userspace to have the same set of files for all domains:
- memory;
- memory.memsw;
- memory.kmem;
- memory.kmem.tcp;
- etc.
Userspace can reuse code for handling them in this case.
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH net-next-2.6] be2net: Add 60 second delay to allow FAT dump completion on recovery from EEH
From: Somnath Kotur @ 2011-10-03 18:10 UTC (permalink / raw)
To: netdev, davem; +Cc: Somnath Kotur
Add 60s delay before timeout on polling Bit 31 so that FAT dump can
complete when reset occurs.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 38c9222..6e7b521 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -416,7 +416,7 @@ int be_cmd_POST(struct be_adapter *adapter)
} else {
return 0;
}
- } while (timeout < 40);
+ } while (timeout < 60);
dev_err(dev, "POST timeout; stage=0x%x\n", stage);
return -1;
--
1.5.6.1
^ permalink raw reply related
* [PATCH] SELinux: Fix RCU deref check warning in sel_netport_insert()
From: David Howells @ 2011-10-03 13:58 UTC (permalink / raw)
To: selinux; +Cc: netdev, dhowells
Fix the following bug in sel_netport_insert() where rcu_dereference() should
be rcu_dereference_protected() as sel_netport_lock is held.
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
security/selinux/netport.c:127 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by ossec-rootcheck/3323:
#0: (sel_netport_lock){+.....}, at: [<ffffffff8117d775>] sel_netport_sid+0xbb/0x226
stack backtrace:
Pid: 3323, comm: ossec-rootcheck Not tainted 3.1.0-rc8-fsdevel+ #1095
Call Trace:
[<ffffffff8105cfb7>] lockdep_rcu_dereference+0xa7/0xb0
[<ffffffff8117d871>] sel_netport_sid+0x1b7/0x226
[<ffffffff8117d6ba>] ? sel_netport_avc_callback+0xbc/0xbc
[<ffffffff8117556c>] selinux_socket_bind+0x115/0x230
[<ffffffff810a5388>] ? might_fault+0x4e/0x9e
[<ffffffff810a53d1>] ? might_fault+0x97/0x9e
[<ffffffff81171cf4>] security_socket_bind+0x11/0x13
[<ffffffff812ba967>] sys_bind+0x56/0x95
[<ffffffff81380dac>] ? sysret_check+0x27/0x62
[<ffffffff8105b767>] ? trace_hardirqs_on_caller+0x11e/0x155
[<ffffffff81076fcd>] ? audit_syscall_entry+0x17b/0x1ae
[<ffffffff811b5eae>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[<ffffffff81380d7b>] system_call_fastpath+0x16/0x1b
Signed-off-by: David Howells <dhowells@redhat.com>
---
security/selinux/netport.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/security/selinux/netport.c b/security/selinux/netport.c
index 0b62bd1..39e2138 100644
--- a/security/selinux/netport.c
+++ b/security/selinux/netport.c
@@ -123,7 +123,9 @@ static void sel_netport_insert(struct sel_netport *port)
if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) {
struct sel_netport *tail;
tail = list_entry(
- rcu_dereference(sel_netport_hash[idx].list.prev),
+ rcu_dereference_protected(
+ sel_netport_hash[idx].list.prev,
+ spin_is_locked(&sel_netport_lock)),
struct sel_netport, list);
list_del_rcu(&tail->list);
kfree_rcu(tail, rcu);
^ permalink raw reply related
* Re: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
From: Thadeu Lima de Souza Cascardo @ 2011-10-03 14:37 UTC (permalink / raw)
To: Yevgeny Petrilin; +Cc: netdev@vger.kernel.org
In-Reply-To: <953B660C027164448AE903364AC447D2235D9A8C@MTLDAG02.mtl.com>
On Sun, Oct 02, 2011 at 08:58:21AM +0000, Yevgeny Petrilin wrote:
>
> > With the addition of Blue Frame support in the network driver for mlx4, the doorbell is not written in the path where blue frame is enabled and the package follows some characteristics.
> >
> > The consequence of that is that ICMP ECHO requests, for example, were not transmitted by the device. A ping flood, for example, would make the
> > watchdog dispatch, because the ring was full and transmissions have timed out.
> >
> > After this fix, I could ping two systems using mlx4_en (both with the fix).
> >
> > Signed-off-by: Thadeu Lima de Souza Cascardo
> > <cascardo@linux.vnet.ibm.com>
> > Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
> > ---
> > drivers/net/ethernet/mellanox/mlx4/en_tx.c | 5 +++--
> > 1 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > index 6e03de0..270da80 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> > @@ -811,10 +811,11 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb,
> > struct net_device *dev)
> > * before setting ownership of this descriptor to HW */
> > wmb();
> > tx_desc->ctrl.owner_opcode = op_own;
> > - wmb();
> > - writel(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
> > }
> >
> > + wmb();
> > + writel(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
> > +
> > /* Poll CQ here */
> > mlx4_en_xmit_poll(priv, tx_ind);
> >
> > --
> > 1.7.4.4
>
> What this patch does is ringing the doorbell unconditionally, whether blue flame is used or not.
> The whole idea, is to copy the data to the blueflame register and have the HW take the data from there and save the memory access to the work queue entry.
> In this patch you do both, copy the data to the register, and then still the HW accesses the memory to take it.
> For some reason Blue flame is not working on your system and we need to understand why, I'll be glad to work with you to debug it.
> Anyway, this patch is not the solution (even that it works on your systems) for the problem.
>
> Yevgeny
Hello, Yevgeny.
We use a MT26448 (lspci -v output bellow) on a POWER7. Any other
information, tests or debug patches you want me to try, just tell me.
I expected this was really not the proper fix, but thought it would be
better to send it than just guess. Any clues what the problem might be?
Perhaps, we would have to disable blue frame for this particular device?
Regards,
Cascardo.
---
lspci output
0006:01:00.0 Ethernet controller: Mellanox Technologies MT26448 [ConnectX EN 10GigE, PCIe 2.0 5GT/s] (rev b0)
---
lspci -v output
0006:01:00.0 0200: 15b3:6750 (rev b0)
Subsystem: 1014:0416
Flags: bus master, fast devsel, latency 0, IRQ 31
Memory at 3da47be00000 (64-bit, non-prefetchable) [size=1M]
Memory at 3da47c000000 (64-bit, prefetchable) [size=32M]
Expansion ROM at 3da47bf00000 [disabled] [size=1M]
Capabilities: [40] Power Management version 3
Capabilities: [48] Vital Product Data
Capabilities: [9c] MSI-X: Enable+ Count=128 Masked-
Capabilities: [60] Express Endpoint, MSI 00
Capabilities: [100] Alternative Routing-ID Interpretation (ARI)
Capabilities: [148] Device Serial Number 00-02-c9-03-00-0f-50-be
Kernel driver in use: mlx4_core
Kernel modules: mlx4_en, mlx4_core
---
^ permalink raw reply
* [PATCH net-next] RPS: Ensure that an expired hardware filter can be re-added later
From: Ben Hutchings @ 2011-10-03 14:42 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Amir Vadai
Amir Vadai wrote:
> When a stream is paused, and its rule is expired while it is paused,
> no new rule will be configured to the HW when traffic resume.
[...]
> - When stream was resumed, traffic was steered again by RSS, and
> because current-cpu was equal to desired-cpu, ndo_rx_flow_steer
> wasn't called and no rule was configured to the HW.
Fix this by setting the flow's current CPU only in the table for the
newly selected RX queue.
Reported-and-tested-by: Amir Vadai <amirv@dev.mellanox.co.il>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
net/core/dev.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 7f4486e..70ecb86 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2670,10 +2670,7 @@ static struct rps_dev_flow *
set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
struct rps_dev_flow *rflow, u16 next_cpu)
{
- u16 tcpu;
-
- tcpu = rflow->cpu = next_cpu;
- if (tcpu != RPS_NO_CPU) {
+ if (next_cpu != RPS_NO_CPU) {
#ifdef CONFIG_RFS_ACCEL
struct netdev_rx_queue *rxqueue;
struct rps_dev_flow_table *flow_table;
@@ -2701,16 +2698,16 @@ set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
goto out;
old_rflow = rflow;
rflow = &flow_table->flows[flow_id];
- rflow->cpu = next_cpu;
rflow->filter = rc;
if (old_rflow->filter == rflow->filter)
old_rflow->filter = RPS_NO_FILTER;
out:
#endif
rflow->last_qtail =
- per_cpu(softnet_data, tcpu).input_queue_head;
+ per_cpu(softnet_data, next_cpu).input_queue_head;
}
+ rflow->cpu = next_cpu;
return rflow;
}
--
1.7.4.4
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
* RE: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
From: Yevgeny Petrilin @ 2011-10-03 14:56 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo
Cc: netdev@vger.kernel.org, Eli Cohen, eli@dev.mellanox.co.il
In-Reply-To: <20111003143721.GA3596@oc1711230544.ibm.com>
> Hello, Yevgeny.
>
> We use a MT26448 (lspci -v output bellow) on a POWER7. Any other
> information, tests or debug patches you want me to try, just tell me.
>
> I expected this was really not the proper fix, but thought it would be
> better to send it than just guess. Any clues what the problem might be?
> Perhaps, we would have to disable blue frame for this particular device?
>
> Regards,
> Cascardo.
>
> ---
> lspci output
> 0006:01:00.0 Ethernet controller: Mellanox Technologies MT26448 [ConnectX EN 10GigE, PCIe 2.0 5GT/s] (rev b0)
> ---
> lspci -v output
> 0006:01:00.0 0200: 15b3:6750 (rev b0)
> Subsystem: 1014:0416
> Flags: bus master, fast devsel, latency 0, IRQ 31
> Memory at 3da47be00000 (64-bit, non-prefetchable) [size=1M]
> Memory at 3da47c000000 (64-bit, prefetchable) [size=32M]
> Expansion ROM at 3da47bf00000 [disabled] [size=1M]
> Capabilities: [40] Power Management version 3
> Capabilities: [48] Vital Product Data
> Capabilities: [9c] MSI-X: Enable+ Count=128 Masked-
> Capabilities: [60] Express Endpoint, MSI 00
> Capabilities: [100] Alternative Routing-ID Interpretation (ARI)
> Capabilities: [148] Device Serial Number 00-02-c9-03-00-0f-50-be
> Kernel driver in use: mlx4_core
> Kernel modules: mlx4_en, mlx4_core
> ---
Cascardo,
Can you also send me the output of ethtool -i?
It seems that there is a problem with write combining on Power processors, we will check this issue.
Yevgeny
^ permalink raw reply
* Re: [PATCH v4 3/8] foundations of per-cgroup memory pressure controlling.
From: Andrew Vagin @ 2011-10-03 15:13 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, paul, lizf, kamezawa.hiroyu, ebiederm, davem,
gthelen, netdev, linux-mm, kirill
In-Reply-To: <1317637123-18306-4-git-send-email-glommer@parallels.com>
I have some compilation issues:
[root@ws-qual linux-2.6]# make -j 32
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CHK include/linux/version.h
Building modules, stage 2.
MODPOST 78 modules
Kernel: arch/x86/boot/bzImage is ready (#127)
ERROR: "memory_pressure_tcp" [net/ipv6/ipv6.ko] undefined!
ERROR: "tcp_sysctl_mem" [net/ipv6/ipv6.ko] undefined!
ERROR: "memory_allocated_tcp" [net/ipv6/ipv6.ko] undefined!
ERROR: "tcp_enter_memory_pressure" [net/ipv6/ipv6.ko] undefined!
ERROR: "sockets_allocated_tcp" [net/ipv6/ipv6.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
I compile ipv6 as module.
mm/memcontrol.c
I think you forgot export some functions.
On Mon, Oct 03, 2011 at 02:18:38PM +0400, Glauber Costa wrote:
> This patch converts struct sock fields memory_pressure,
> memory_allocated, sockets_allocated, and sysctl_mem (now prot_mem)
> to function pointers, receiving a struct mem_cgroup parameter.
>
> enter_memory_pressure is kept the same, since all its callers
> have socket a context, and the kmem_cgroup can be derived from
> the socket itself.
>
> To keep things working, the patch convert all users of those fields
> to use acessor functions.
>
> In my benchmarks I didn't see a significant performance difference
> with this patch applied compared to a baseline (around 1 % diff, thus
> inside error margin).
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Eric W. Biederman <ebiederm@xmission.com>
> ---
> crypto/af_alg.c | 7 ++-
> include/linux/memcontrol.h | 29 +++++++++++-
> include/net/sock.h | 112 +++++++++++++++++++++++++++++++++++++++++--
> include/net/tcp.h | 11 +++--
> include/net/udp.h | 3 +-
> include/trace/events/sock.h | 10 ++--
> mm/memcontrol.c | 45 +++++++++++++++++-
> net/core/sock.c | 62 ++++++++++++++----------
> net/decnet/af_decnet.c | 21 +++++++-
> net/ipv4/proc.c | 7 ++-
> net/ipv4/tcp.c | 27 +++++++++-
> net/ipv4/tcp_input.c | 12 ++--
> net/ipv4/tcp_ipv4.c | 12 ++--
> net/ipv4/tcp_output.c | 2 +-
> net/ipv4/tcp_timer.c | 2 +-
> net/ipv4/udp.c | 20 ++++++--
> net/ipv6/tcp_ipv6.c | 10 ++--
> net/ipv6/udp.c | 4 +-
> net/sctp/socket.c | 35 ++++++++++---
> 19 files changed, 345 insertions(+), 86 deletions(-)
>
> diff --git a/crypto/af_alg.c b/crypto/af_alg.c
> index ac33d5f..9f41324 100644
> --- a/crypto/af_alg.c
> +++ b/crypto/af_alg.c
> @@ -29,10 +29,15 @@ struct alg_type_list {
>
> static atomic_long_t alg_memory_allocated;
>
> +static atomic_long_t *memory_allocated_alg(struct mem_cgroup *memcg)
> +{
> + return &alg_memory_allocated;
> +}
> +
> static struct proto alg_proto = {
> .name = "ALG",
> .owner = THIS_MODULE,
> - .memory_allocated = &alg_memory_allocated,
> + .memory_allocated = memory_allocated_alg,
> .obj_size = sizeof(struct alg_sock),
> };
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 2cb9226..d0b973c 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -380,6 +380,10 @@ static inline
> void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
> {
> }
> +static inline struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p)
> +{
> + return NULL;
> +}
> #endif /* CONFIG_CGROUP_MEM_CONT */
>
> #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
> @@ -397,11 +401,34 @@ mem_cgroup_print_bad_page(struct page *page)
>
> #ifdef CONFIG_INET
> struct sock;
> +struct proto;
> #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
> void sock_update_memcg(struct sock *sk);
> void sock_release_memcg(struct sock *sk);
> -
> +void memcg_sock_mem_alloc(struct mem_cgroup *mem, struct proto *prot,
> + int amt, int *parent_failure);
> +void memcg_sock_mem_free(struct mem_cgroup *mem, struct proto *prot, int amt);
> +void memcg_sockets_allocated_dec(struct mem_cgroup *mem, struct proto *prot);
> +void memcg_sockets_allocated_inc(struct mem_cgroup *mem, struct proto *prot);
> #else
> +/* memcontrol includes sockets.h, that includes memcontrol.h ... */
> +static inline void memcg_sock_mem_alloc(struct mem_cgroup *mem,
> + struct proto *prot, int amt,
> + int *parent_failure)
> +{
> +}
> +static inline void memcg_sock_mem_free(struct mem_cgroup *mem,
> + struct proto *prot, int amt)
> +{
> +}
> +static inline void memcg_sockets_allocated_dec(struct mem_cgroup *mem,
> + struct proto *prot)
> +{
> +}
> +static inline void memcg_sockets_allocated_inc(struct mem_cgroup *mem,
> + struct proto *prot)
> +{
> +}
> static inline void sock_update_memcg(struct sock *sk)
> {
> }
> diff --git a/include/net/sock.h b/include/net/sock.h
> index afe1467..c6983cf 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -54,6 +54,7 @@
> #include <linux/security.h>
> #include <linux/slab.h>
> #include <linux/uaccess.h>
> +#include <linux/cgroup.h>
>
> #include <linux/filter.h>
> #include <linux/rculist_nulls.h>
> @@ -168,6 +169,8 @@ struct sock_common {
> /* public: */
> };
>
> +struct mem_cgroup;
> +
> /**
> * struct sock - network layer representation of sockets
> * @__sk_common: shared layout with inet_timewait_sock
> @@ -786,18 +789,32 @@ struct proto {
> unsigned int inuse_idx;
> #endif
>
> + /*
> + * per-cgroup memory tracking:
> + *
> + * The following functions track memory consumption of network buffers
> + * by cgroup (kmem_cgroup) for the current protocol. As of the rest
> + * of the fields in this structure, not all protocols are required
> + * to implement them. Protocols that don't want to do per-cgroup
> + * memory pressure management, can just assume the root cgroup is used.
> + *
> + */
> /* Memory pressure */
> void (*enter_memory_pressure)(struct sock *sk);
> - atomic_long_t *memory_allocated; /* Current allocated memory. */
> - struct percpu_counter *sockets_allocated; /* Current number of sockets. */
> + /* Pointer to the current memory allocation of this cgroup. */
> + atomic_long_t *(*memory_allocated)(struct mem_cgroup *memcg);
> + /* Pointer to the current number of sockets in this cgroup. */
> + struct percpu_counter *(*sockets_allocated)(struct mem_cgroup *memcg);
> /*
> - * Pressure flag: try to collapse.
> + * Per cgroup pointer to the pressure flag: try to collapse.
> * Technical note: it is used by multiple contexts non atomically.
> * All the __sk_mem_schedule() is of this nature: accounting
> * is strict, actions are advisory and have some latency.
> */
> - int *memory_pressure;
> - long *sysctl_mem;
> + int *(*memory_pressure)(struct mem_cgroup *memcg);
> + /* Pointer to the per-cgroup version of the the sysctl_mem field */
> + long *(*prot_mem)(struct mem_cgroup *memcg);
> +
> int *sysctl_wmem;
> int *sysctl_rmem;
> int max_header;
> @@ -856,6 +873,91 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
> #define sk_refcnt_debug_release(sk) do { } while (0)
> #endif /* SOCK_REFCNT_DEBUG */
>
> +#include <linux/memcontrol.h>
> +static inline int *sk_memory_pressure(struct sock *sk)
> +{
> + int *ret = NULL;
> + if (sk->sk_prot->memory_pressure)
> + ret = sk->sk_prot->memory_pressure(sk->sk_cgrp);
> + return ret;
> +}
> +
> +static inline long sk_prot_mem(struct sock *sk, int index)
> +{
> + long *prot = sk->sk_prot->prot_mem(sk->sk_cgrp);
> + return prot[index];
> +}
> +
> +static inline long
> +sk_memory_allocated(struct sock *sk)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> +
> + return atomic_long_read(prot->memory_allocated(cg));
> +}
> +
> +static inline long
> +sk_memory_allocated_add(struct sock *sk, int amt, int *parent_failure)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> + long allocated;
> +
> + allocated = atomic_long_add_return(amt, prot->memory_allocated(cg));
> + memcg_sock_mem_alloc(cg, prot, amt, parent_failure);
> + return allocated;
> +}
> +
> +static inline void
> +sk_memory_allocated_sub(struct sock *sk, int amt)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> +
> + atomic_long_sub(amt, prot->memory_allocated(cg));
> + memcg_sock_mem_free(cg, prot, amt);
> +}
> +
> +static inline void sk_sockets_allocated_dec(struct sock *sk)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> +
> + percpu_counter_dec(prot->sockets_allocated(cg));
> + memcg_sockets_allocated_dec(cg, prot);
> +}
> +
> +static inline void sk_sockets_allocated_inc(struct sock *sk)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> +
> + percpu_counter_inc(prot->sockets_allocated(cg));
> + memcg_sockets_allocated_inc(cg, prot);
> +}
> +
> +static inline int
> +sk_sockets_allocated_read_positive(struct sock *sk)
> +{
> + struct proto *prot = sk->sk_prot;
> + struct mem_cgroup *cg = sk->sk_cgrp;
> +
> + return percpu_counter_sum_positive(prot->sockets_allocated(cg));
> +}
> +
> +static inline int
> +kcg_sockets_allocated_sum_positive(struct proto *prot, struct mem_cgroup *cg)
> +{
> + return percpu_counter_sum_positive(prot->sockets_allocated(cg));
> +}
> +
> +static inline long
> +kcg_memory_allocated(struct proto *prot, struct mem_cgroup *cg)
> +{
> + return atomic_long_read(prot->memory_allocated(cg));
> +}
> +
>
> #ifdef CONFIG_PROC_FS
> /* Called with local bh disabled */
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 149a415..2200694 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -45,6 +45,7 @@
> #include <net/dst.h>
>
> #include <linux/seq_file.h>
> +#include <linux/memcontrol.h>
>
> extern struct inet_hashinfo tcp_hashinfo;
>
> @@ -253,9 +254,11 @@ extern int sysctl_tcp_cookie_size;
> extern int sysctl_tcp_thin_linear_timeouts;
> extern int sysctl_tcp_thin_dupack;
>
> -extern atomic_long_t tcp_memory_allocated;
> -extern struct percpu_counter tcp_sockets_allocated;
> -extern int tcp_memory_pressure;
> +struct mem_cgroup;
> +extern long *tcp_sysctl_mem(struct mem_cgroup *memcg);
> +struct percpu_counter *sockets_allocated_tcp(struct mem_cgroup *memcg);
> +int *memory_pressure_tcp(struct mem_cgroup *memcg);
> +atomic_long_t *memory_allocated_tcp(struct mem_cgroup *memcg);
>
> /*
> * The next routines deal with comparing 32 bit unsigned ints
> @@ -286,7 +289,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
> }
>
> if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
> - atomic_long_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])
> + sk_memory_allocated(sk) > sk_prot_mem(sk, 2))
> return true;
> return false;
> }
> diff --git a/include/net/udp.h b/include/net/udp.h
> index 67ea6fc..b96ed51 100644
> --- a/include/net/udp.h
> +++ b/include/net/udp.h
> @@ -105,7 +105,8 @@ static inline struct udp_hslot *udp_hashslot2(struct udp_table *table,
>
> extern struct proto udp_prot;
>
> -extern atomic_long_t udp_memory_allocated;
> +atomic_long_t *memory_allocated_udp(struct mem_cgroup *memcg);
> +long *udp_sysctl_mem(struct mem_cgroup *memcg);
>
> /* sysctl variables for udp */
> extern long sysctl_udp_mem[3];
> diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
> index 779abb9..12a6083 100644
> --- a/include/trace/events/sock.h
> +++ b/include/trace/events/sock.h
> @@ -37,7 +37,7 @@ TRACE_EVENT(sock_exceed_buf_limit,
>
> TP_STRUCT__entry(
> __array(char, name, 32)
> - __field(long *, sysctl_mem)
> + __field(long *, prot_mem)
> __field(long, allocated)
> __field(int, sysctl_rmem)
> __field(int, rmem_alloc)
> @@ -45,7 +45,7 @@ TRACE_EVENT(sock_exceed_buf_limit,
>
> TP_fast_assign(
> strncpy(__entry->name, prot->name, 32);
> - __entry->sysctl_mem = prot->sysctl_mem;
> + __entry->prot_mem = sk->sk_prot->prot_mem(sk->sk_cgrp);
> __entry->allocated = allocated;
> __entry->sysctl_rmem = prot->sysctl_rmem[0];
> __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
> @@ -54,9 +54,9 @@ TRACE_EVENT(sock_exceed_buf_limit,
> TP_printk("proto:%s sysctl_mem=%ld,%ld,%ld allocated=%ld "
> "sysctl_rmem=%d rmem_alloc=%d",
> __entry->name,
> - __entry->sysctl_mem[0],
> - __entry->sysctl_mem[1],
> - __entry->sysctl_mem[2],
> + __entry->prot_mem[0],
> + __entry->prot_mem[1],
> + __entry->prot_mem[2],
> __entry->allocated,
> __entry->sysctl_rmem,
> __entry->rmem_alloc)
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 08a520e..1586332 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -339,6 +339,7 @@ struct mem_cgroup {
> spinlock_t pcp_counter_lock;
> };
>
> +static struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *mem);
> /* Writing them here to avoid exposing memcg's inner layout */
> #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
> #ifdef CONFIG_INET
> @@ -369,6 +370,49 @@ void sock_release_memcg(struct sock *sk)
> {
> cgroup_release_and_wakeup_rmdir(mem_cgroup_css(sk->sk_cgrp));
> }
> +
> +void memcg_sock_mem_alloc(struct mem_cgroup *mem, struct proto *prot,
> + int amt, int *parent_failure)
> +{
> + mem = parent_mem_cgroup(mem);
> + for (; mem != NULL; mem = parent_mem_cgroup(mem)) {
> + long alloc;
> + long *prot_mem = prot->prot_mem(mem);
> + /*
> + * Large nestings are not the common case, and stopping in the
> + * middle would be complicated enough, that we bill it all the
> + * way through the root, and if needed, unbill everything later
> + */
> + alloc = atomic_long_add_return(amt,
> + prot->memory_allocated(mem));
> + *parent_failure |= (alloc > prot_mem[2]);
> + }
> +}
> +EXPORT_SYMBOL(memcg_sock_mem_alloc);
> +
> +void memcg_sock_mem_free(struct mem_cgroup *mem, struct proto *prot, int amt)
> +{
> + mem = parent_mem_cgroup(mem);
> + for (; mem != NULL; mem = parent_mem_cgroup(mem))
> + atomic_long_sub(amt, prot->memory_allocated(mem));
> +}
> +EXPORT_SYMBOL(memcg_sock_mem_free);
> +
> +void memcg_sockets_allocated_dec(struct mem_cgroup *mem, struct proto *prot)
> +{
> + mem = parent_mem_cgroup(mem);
> + for (; mem; mem = parent_mem_cgroup(mem))
> + percpu_counter_dec(prot->sockets_allocated(mem));
> +}
> +EXPORT_SYMBOL(memcg_sockets_allocated_dec);
> +
> +void memcg_sockets_allocated_inc(struct mem_cgroup *mem, struct proto *prot)
> +{
> + mem = parent_mem_cgroup(mem);
> + for (; mem; mem = parent_mem_cgroup(mem))
> + percpu_counter_inc(prot->sockets_allocated(mem));
> +}
> +EXPORT_SYMBOL(memcg_sockets_allocated_inc);
> #endif /* CONFIG_INET */
> #endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
>
> @@ -454,7 +498,6 @@ enum mem_type {
>
> static void mem_cgroup_get(struct mem_cgroup *mem);
> static void mem_cgroup_put(struct mem_cgroup *mem);
> -static struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *mem);
> static void drain_all_stock_async(struct mem_cgroup *mem);
>
> static struct mem_cgroup_per_zone *
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 5426ba0..6e3ace7 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -1293,7 +1293,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
> newsk->sk_wq = NULL;
>
> if (newsk->sk_prot->sockets_allocated)
> - percpu_counter_inc(newsk->sk_prot->sockets_allocated);
> + sk_sockets_allocated_inc(newsk);
>
> if (sock_flag(newsk, SOCK_TIMESTAMP) ||
> sock_flag(newsk, SOCK_TIMESTAMPING_RX_SOFTWARE))
> @@ -1684,30 +1684,33 @@ int __sk_mem_schedule(struct sock *sk, int size, int kind)
> struct proto *prot = sk->sk_prot;
> int amt = sk_mem_pages(size);
> long allocated;
> + int *memory_pressure;
> + int parent_failure = 0;
>
> sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
> - allocated = atomic_long_add_return(amt, prot->memory_allocated);
> +
> + memory_pressure = sk_memory_pressure(sk);
> + allocated = sk_memory_allocated_add(sk, amt, &parent_failure);
> +
> + /* Over hard limit (we, or our parents) */
> + if (parent_failure || (allocated > sk_prot_mem(sk, 2)))
> + goto suppress_allocation;
>
> /* Under limit. */
> - if (allocated <= prot->sysctl_mem[0]) {
> - if (prot->memory_pressure && *prot->memory_pressure)
> - *prot->memory_pressure = 0;
> - return 1;
> - }
> + if (allocated <= sk_prot_mem(sk, 0))
> + if (memory_pressure && *memory_pressure)
> + *memory_pressure = 0;
>
> /* Under pressure. */
> - if (allocated > prot->sysctl_mem[1])
> + if (allocated > sk_prot_mem(sk, 1))
> if (prot->enter_memory_pressure)
> prot->enter_memory_pressure(sk);
>
> - /* Over hard limit. */
> - if (allocated > prot->sysctl_mem[2])
> - goto suppress_allocation;
> -
> /* guarantee minimum buffer size under pressure */
> if (kind == SK_MEM_RECV) {
> if (atomic_read(&sk->sk_rmem_alloc) < prot->sysctl_rmem[0])
> return 1;
> +
> } else { /* SK_MEM_SEND */
> if (sk->sk_type == SOCK_STREAM) {
> if (sk->sk_wmem_queued < prot->sysctl_wmem[0])
> @@ -1717,13 +1720,13 @@ int __sk_mem_schedule(struct sock *sk, int size, int kind)
> return 1;
> }
>
> - if (prot->memory_pressure) {
> + if (memory_pressure) {
> int alloc;
>
> - if (!*prot->memory_pressure)
> + if (!*memory_pressure)
> return 1;
> - alloc = percpu_counter_read_positive(prot->sockets_allocated);
> - if (prot->sysctl_mem[2] > alloc *
> + alloc = sk_sockets_allocated_read_positive(sk);
> + if (sk_prot_mem(sk, 2) > alloc *
> sk_mem_pages(sk->sk_wmem_queued +
> atomic_read(&sk->sk_rmem_alloc) +
> sk->sk_forward_alloc))
> @@ -1746,7 +1749,9 @@ suppress_allocation:
>
> /* Alas. Undo changes. */
> sk->sk_forward_alloc -= amt * SK_MEM_QUANTUM;
> - atomic_long_sub(amt, prot->memory_allocated);
> +
> + sk_memory_allocated_sub(sk, amt);
> +
> return 0;
> }
> EXPORT_SYMBOL(__sk_mem_schedule);
> @@ -1757,15 +1762,15 @@ EXPORT_SYMBOL(__sk_mem_schedule);
> */
> void __sk_mem_reclaim(struct sock *sk)
> {
> - struct proto *prot = sk->sk_prot;
> + int *memory_pressure = sk_memory_pressure(sk);
>
> - atomic_long_sub(sk->sk_forward_alloc >> SK_MEM_QUANTUM_SHIFT,
> - prot->memory_allocated);
> + sk_memory_allocated_sub(sk,
> + sk->sk_forward_alloc >> SK_MEM_QUANTUM_SHIFT);
> sk->sk_forward_alloc &= SK_MEM_QUANTUM - 1;
>
> - if (prot->memory_pressure && *prot->memory_pressure &&
> - (atomic_long_read(prot->memory_allocated) < prot->sysctl_mem[0]))
> - *prot->memory_pressure = 0;
> + if (memory_pressure && *memory_pressure &&
> + (sk_memory_allocated(sk) < sk_prot_mem(sk, 0)))
> + *memory_pressure = 0;
> }
> EXPORT_SYMBOL(__sk_mem_reclaim);
>
> @@ -2484,13 +2489,20 @@ static char proto_method_implemented(const void *method)
>
> static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
> {
> + struct mem_cgroup *cg = mem_cgroup_from_task(current);
> + int *memory_pressure = NULL;
> +
> + if (proto->memory_pressure)
> + memory_pressure = proto->memory_pressure(cg);
> +
> seq_printf(seq, "%-9s %4u %6d %6ld %-3s %6u %-3s %-10s "
> "%2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c\n",
> proto->name,
> proto->obj_size,
> sock_prot_inuse_get(seq_file_net(seq), proto),
> - proto->memory_allocated != NULL ? atomic_long_read(proto->memory_allocated) : -1L,
> - proto->memory_pressure != NULL ? *proto->memory_pressure ? "yes" : "no" : "NI",
> + proto->memory_allocated != NULL ?
> + kcg_memory_allocated(proto, cg) : -1L,
> + memory_pressure != NULL ? *memory_pressure ? "yes" : "no" : "NI",
> proto->max_header,
> proto->slab == NULL ? "no" : "yes",
> module_name(proto->owner),
> diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
> index 19acd00..39f83b4 100644
> --- a/net/decnet/af_decnet.c
> +++ b/net/decnet/af_decnet.c
> @@ -458,13 +458,28 @@ static void dn_enter_memory_pressure(struct sock *sk)
> }
> }
>
> +static atomic_long_t *memory_allocated_dn(struct mem_cgroup *memcg)
> +{
> + return &decnet_memory_allocated;
> +}
> +
> +static int *memory_pressure_dn(struct mem_cgroup *memcg)
> +{
> + return &dn_memory_pressure;
> +}
> +
> +static long *dn_sysctl_mem(struct mem_cgroup *memcg)
> +{
> + return sysctl_decnet_mem;
> +}
> +
> static struct proto dn_proto = {
> .name = "NSP",
> .owner = THIS_MODULE,
> .enter_memory_pressure = dn_enter_memory_pressure,
> - .memory_pressure = &dn_memory_pressure,
> - .memory_allocated = &decnet_memory_allocated,
> - .sysctl_mem = sysctl_decnet_mem,
> + .memory_pressure = memory_pressure_dn,
> + .memory_allocated = memory_allocated_dn,
> + .prot_mem = dn_sysctl_mem,
> .sysctl_wmem = sysctl_decnet_wmem,
> .sysctl_rmem = sysctl_decnet_rmem,
> .max_header = DN_MAX_NSP_DATA_HEADER + 64,
> diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
> index b14ec7d..ba56702 100644
> --- a/net/ipv4/proc.c
> +++ b/net/ipv4/proc.c
> @@ -52,20 +52,21 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
> {
> struct net *net = seq->private;
> int orphans, sockets;
> + struct mem_cgroup *cg = mem_cgroup_from_task(current);
>
> local_bh_disable();
> orphans = percpu_counter_sum_positive(&tcp_orphan_count);
> - sockets = percpu_counter_sum_positive(&tcp_sockets_allocated);
> + sockets = kcg_sockets_allocated_sum_positive(&tcp_prot, cg);
> local_bh_enable();
>
> socket_seq_show(seq);
> seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n",
> sock_prot_inuse_get(net, &tcp_prot), orphans,
> tcp_death_row.tw_count, sockets,
> - atomic_long_read(&tcp_memory_allocated));
> + kcg_memory_allocated(&tcp_prot, cg));
> seq_printf(seq, "UDP: inuse %d mem %ld\n",
> sock_prot_inuse_get(net, &udp_prot),
> - atomic_long_read(&udp_memory_allocated));
> + kcg_memory_allocated(&udp_prot, cg));
> seq_printf(seq, "UDPLITE: inuse %d\n",
> sock_prot_inuse_get(net, &udplite_prot));
> seq_printf(seq, "RAW: inuse %d\n",
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 46febca..ca82b90 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -291,13 +291,11 @@ EXPORT_SYMBOL(sysctl_tcp_rmem);
> EXPORT_SYMBOL(sysctl_tcp_wmem);
>
> atomic_long_t tcp_memory_allocated; /* Current allocated memory. */
> -EXPORT_SYMBOL(tcp_memory_allocated);
>
> /*
> * Current number of TCP sockets.
> */
> struct percpu_counter tcp_sockets_allocated;
> -EXPORT_SYMBOL(tcp_sockets_allocated);
>
> /*
> * TCP splice context
> @@ -315,7 +313,18 @@ struct tcp_splice_state {
> * is strict, actions are advisory and have some latency.
> */
> int tcp_memory_pressure __read_mostly;
> -EXPORT_SYMBOL(tcp_memory_pressure);
> +
> +int *memory_pressure_tcp(struct mem_cgroup *memcg)
> +{
> + return &tcp_memory_pressure;
> +}
> +EXPORT_SYMBOL(memory_pressure_tcp);
> +
> +struct percpu_counter *sockets_allocated_tcp(struct mem_cgroup *memcg)
> +{
> + return &tcp_sockets_allocated;
> +}
> +EXPORT_SYMBOL(sockets_allocated_tcp);
>
> void tcp_enter_memory_pressure(struct sock *sk)
> {
> @@ -326,6 +335,18 @@ void tcp_enter_memory_pressure(struct sock *sk)
> }
> EXPORT_SYMBOL(tcp_enter_memory_pressure);
>
> +long *tcp_sysctl_mem(struct mem_cgroup *memcg)
> +{
> + return sysctl_tcp_mem;
> +}
> +EXPORT_SYMBOL(tcp_sysctl_mem);
> +
> +atomic_long_t *memory_allocated_tcp(struct mem_cgroup *memcg)
> +{
> + return &tcp_memory_allocated;
> +}
> +EXPORT_SYMBOL(memory_allocated_tcp);
> +
> /* Convert seconds to retransmits based on initial and max timeout */
> static u8 secs_to_retrans(int seconds, int timeout, int rto_max)
> {
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index ea0d218..3f17423 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -316,7 +316,7 @@ static void tcp_grow_window(struct sock *sk, struct sk_buff *skb)
> /* Check #1 */
> if (tp->rcv_ssthresh < tp->window_clamp &&
> (int)tp->rcv_ssthresh < tcp_space(sk) &&
> - !tcp_memory_pressure) {
> + !sk_memory_pressure(sk)) {
> int incr;
>
> /* Check #2. Increase window, if skb with such overhead
> @@ -398,8 +398,8 @@ static void tcp_clamp_window(struct sock *sk)
>
> if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] &&
> !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
> - !tcp_memory_pressure &&
> - atomic_long_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) {
> + !sk_memory_pressure(sk) &&
> + sk_memory_allocated(sk) < sk_prot_mem(sk, 0)) {
> sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc),
> sysctl_tcp_rmem[2]);
> }
> @@ -4806,7 +4806,7 @@ static int tcp_prune_queue(struct sock *sk)
>
> if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
> tcp_clamp_window(sk);
> - else if (tcp_memory_pressure)
> + else if (sk_memory_pressure(sk))
> tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U * tp->advmss);
>
> tcp_collapse_ofo_queue(sk);
> @@ -4872,11 +4872,11 @@ static int tcp_should_expand_sndbuf(struct sock *sk)
> return 0;
>
> /* If we are under global TCP memory pressure, do not expand. */
> - if (tcp_memory_pressure)
> + if (sk_memory_pressure(sk))
> return 0;
>
> /* If we are under soft global TCP memory pressure, do not expand. */
> - if (atomic_long_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0])
> + if (sk_memory_allocated(sk) >= sk_prot_mem(sk, 0))
> return 0;
>
> /* If we filled the congestion window, do not expand. */
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 1c12b8e..cbb0d5e 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -1901,7 +1901,7 @@ static int tcp_v4_init_sock(struct sock *sk)
> sk->sk_rcvbuf = sysctl_tcp_rmem[1];
>
> local_bh_disable();
> - percpu_counter_inc(&tcp_sockets_allocated);
> + sk_sockets_allocated_inc(sk);
> local_bh_enable();
>
> return 0;
> @@ -1957,7 +1957,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
> tp->cookie_values = NULL;
> }
>
> - percpu_counter_dec(&tcp_sockets_allocated);
> + sk_sockets_allocated_dec(sk);
> }
> EXPORT_SYMBOL(tcp_v4_destroy_sock);
>
> @@ -2598,11 +2598,11 @@ struct proto tcp_prot = {
> .unhash = inet_unhash,
> .get_port = inet_csk_get_port,
> .enter_memory_pressure = tcp_enter_memory_pressure,
> - .sockets_allocated = &tcp_sockets_allocated,
> + .memory_pressure = memory_pressure_tcp,
> + .sockets_allocated = sockets_allocated_tcp,
> .orphan_count = &tcp_orphan_count,
> - .memory_allocated = &tcp_memory_allocated,
> - .memory_pressure = &tcp_memory_pressure,
> - .sysctl_mem = sysctl_tcp_mem,
> + .memory_allocated = memory_allocated_tcp,
> + .prot_mem = tcp_sysctl_mem,
> .sysctl_wmem = sysctl_tcp_wmem,
> .sysctl_rmem = sysctl_tcp_rmem,
> .max_header = MAX_TCP_HEADER,
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 882e0b0..06aeb31 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1912,7 +1912,7 @@ u32 __tcp_select_window(struct sock *sk)
> if (free_space < (full_space >> 1)) {
> icsk->icsk_ack.quick = 0;
>
> - if (tcp_memory_pressure)
> + if (sk_memory_pressure(sk))
> tp->rcv_ssthresh = min(tp->rcv_ssthresh,
> 4U * tp->advmss);
>
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
> index ecd44b0..2c67617 100644
> --- a/net/ipv4/tcp_timer.c
> +++ b/net/ipv4/tcp_timer.c
> @@ -261,7 +261,7 @@ static void tcp_delack_timer(unsigned long data)
> }
>
> out:
> - if (tcp_memory_pressure)
> + if (sk_memory_pressure(sk))
> sk_mem_reclaim(sk);
> out_unlock:
> bh_unlock_sock(sk);
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 1b5a193..f8d72ce 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -120,9 +120,6 @@ EXPORT_SYMBOL(sysctl_udp_rmem_min);
> int sysctl_udp_wmem_min __read_mostly;
> EXPORT_SYMBOL(sysctl_udp_wmem_min);
>
> -atomic_long_t udp_memory_allocated;
> -EXPORT_SYMBOL(udp_memory_allocated);
> -
> #define MAX_UDP_PORTS 65536
> #define PORTS_PER_CHAIN (MAX_UDP_PORTS / UDP_HTABLE_SIZE_MIN)
>
> @@ -1918,6 +1915,19 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
> }
> EXPORT_SYMBOL(udp_poll);
>
> +static atomic_long_t udp_memory_allocated;
> +atomic_long_t *memory_allocated_udp(struct mem_cgroup *memcg)
> +{
> + return &udp_memory_allocated;
> +}
> +EXPORT_SYMBOL(memory_allocated_udp);
> +
> +long *udp_sysctl_mem(struct mem_cgroup *memcg)
> +{
> + return sysctl_udp_mem;
> +}
> +EXPORT_SYMBOL(udp_sysctl_mem);
> +
> struct proto udp_prot = {
> .name = "UDP",
> .owner = THIS_MODULE,
> @@ -1936,8 +1946,8 @@ struct proto udp_prot = {
> .unhash = udp_lib_unhash,
> .rehash = udp_v4_rehash,
> .get_port = udp_v4_get_port,
> - .memory_allocated = &udp_memory_allocated,
> - .sysctl_mem = sysctl_udp_mem,
> + .memory_allocated = &memory_allocated_udp,
> + .prot_mem = udp_sysctl_mem,
> .sysctl_wmem = &sysctl_udp_wmem_min,
> .sysctl_rmem = &sysctl_udp_rmem_min,
> .obj_size = sizeof(struct udp_sock),
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index d1fb63f..807797a 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -2012,7 +2012,7 @@ static int tcp_v6_init_sock(struct sock *sk)
> sk->sk_rcvbuf = sysctl_tcp_rmem[1];
>
> local_bh_disable();
> - percpu_counter_inc(&tcp_sockets_allocated);
> + sk_sockets_allocated_inc(sk);
> local_bh_enable();
>
> return 0;
> @@ -2221,11 +2221,11 @@ struct proto tcpv6_prot = {
> .unhash = inet_unhash,
> .get_port = inet_csk_get_port,
> .enter_memory_pressure = tcp_enter_memory_pressure,
> - .sockets_allocated = &tcp_sockets_allocated,
> - .memory_allocated = &tcp_memory_allocated,
> - .memory_pressure = &tcp_memory_pressure,
> + .sockets_allocated = sockets_allocated_tcp,
> + .memory_allocated = memory_allocated_tcp,
> + .memory_pressure = memory_pressure_tcp,
> .orphan_count = &tcp_orphan_count,
> - .sysctl_mem = sysctl_tcp_mem,
> + .prot_mem = tcp_sysctl_mem,
> .sysctl_wmem = sysctl_tcp_wmem,
> .sysctl_rmem = sysctl_tcp_rmem,
> .max_header = MAX_TCP_HEADER,
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 29213b5..ef4b5b3 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1465,8 +1465,8 @@ struct proto udpv6_prot = {
> .unhash = udp_lib_unhash,
> .rehash = udp_v6_rehash,
> .get_port = udp_v6_get_port,
> - .memory_allocated = &udp_memory_allocated,
> - .sysctl_mem = sysctl_udp_mem,
> + .memory_allocated = memory_allocated_udp,
> + .prot_mem = udp_sysctl_mem,
> .sysctl_wmem = &sysctl_udp_wmem_min,
> .sysctl_rmem = &sysctl_udp_rmem_min,
> .obj_size = sizeof(struct udp6_sock),
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 836aa63..62eb178 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -119,11 +119,30 @@ static int sctp_memory_pressure;
> static atomic_long_t sctp_memory_allocated;
> struct percpu_counter sctp_sockets_allocated;
>
> +static long *sctp_sysctl_mem(struct mem_cgroup *memcg)
> +{
> + return sysctl_sctp_mem;
> +}
> +
> static void sctp_enter_memory_pressure(struct sock *sk)
> {
> sctp_memory_pressure = 1;
> }
>
> +static int *memory_pressure_sctp(struct mem_cgroup *memcg)
> +{
> + return &sctp_memory_pressure;
> +}
> +
> +static atomic_long_t *memory_allocated_sctp(struct mem_cgroup *memcg)
> +{
> + return &sctp_memory_allocated;
> +}
> +
> +static struct percpu_counter *sockets_allocated_sctp(struct mem_cgroup *memcg)
> +{
> + return &sctp_sockets_allocated;
> +}
>
> /* Get the sndbuf space available at the time on the association. */
> static inline int sctp_wspace(struct sctp_association *asoc)
> @@ -6831,13 +6850,13 @@ struct proto sctp_prot = {
> .unhash = sctp_unhash,
> .get_port = sctp_get_port,
> .obj_size = sizeof(struct sctp_sock),
> - .sysctl_mem = sysctl_sctp_mem,
> + .prot_mem = sctp_sysctl_mem,
> .sysctl_rmem = sysctl_sctp_rmem,
> .sysctl_wmem = sysctl_sctp_wmem,
> - .memory_pressure = &sctp_memory_pressure,
> + .memory_pressure = memory_pressure_sctp,
> .enter_memory_pressure = sctp_enter_memory_pressure,
> - .memory_allocated = &sctp_memory_allocated,
> - .sockets_allocated = &sctp_sockets_allocated,
> + .memory_allocated = memory_allocated_sctp,
> + .sockets_allocated = sockets_allocated_sctp,
> };
>
> #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
> @@ -6863,12 +6882,12 @@ struct proto sctpv6_prot = {
> .unhash = sctp_unhash,
> .get_port = sctp_get_port,
> .obj_size = sizeof(struct sctp6_sock),
> - .sysctl_mem = sysctl_sctp_mem,
> + .prot_mem = sctp_sysctl_mem,
> .sysctl_rmem = sysctl_sctp_rmem,
> .sysctl_wmem = sysctl_sctp_wmem,
> - .memory_pressure = &sctp_memory_pressure,
> + .memory_pressure = memory_pressure_sctp,
> .enter_memory_pressure = sctp_enter_memory_pressure,
> - .memory_allocated = &sctp_memory_allocated,
> - .sockets_allocated = &sctp_sockets_allocated,
> + .memory_allocated = memory_allocated_sctp,
> + .sockets_allocated = sockets_allocated_sctp,
> };
> #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
> --
> 1.7.6
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [iproute2 PATCH 02/11] Fix file descriptor leak on error in rtnl_hash_initialize()
From: Thomas Jarosch @ 2011-10-03 15:22 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
lib/rt_names.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/rt_names.c b/lib/rt_names.c
index 30d43cd..a290021 100644
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -54,6 +54,7 @@ rtnl_hash_initialize(char *file, struct rtnl_hash_entry **hash, int size)
sscanf(p, "%d %s #", &id, namebuf) != 2) {
fprintf(stderr, "Database %s is corrupted at %s\n",
file, p);
+ fclose(fp);
return;
}
@@ -91,6 +92,7 @@ static void rtnl_tab_initialize(char *file, char **tab, int size)
sscanf(p, "%d %s #", &id, namebuf) != 2) {
fprintf(stderr, "Database %s is corrupted at %s\n",
file, p);
+ fclose(fp);
return;
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 01/11] Fix pipe I/O stream descriptor leak in init_service_resolver()
From: Thomas Jarosch @ 2011-10-03 15:22 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
misc/ss.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 1597ff9..f62d371 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -518,6 +518,7 @@ void init_service_resolver(void)
}
}
}
+ pclose(fp);
}
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 03/11] Fix wrong comparison in cmp_print_eopt()
From: Thomas Jarosch @ 2011-10-03 15:22 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
tc/em_cmp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tc/em_cmp.c b/tc/em_cmp.c
index 6addce0..3e6d00e 100644
--- a/tc/em_cmp.c
+++ b/tc/em_cmp.c
@@ -155,7 +155,7 @@ static int cmp_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
fprintf(fd, "u8 ");
else if (cmp->align == TCF_EM_ALIGN_U16)
fprintf(fd, "u16 ");
- else if (cmp->align == TCF_EM_ALIGN_U16)
+ else if (cmp->align == TCF_EM_ALIGN_U32)
fprintf(fd, "u32 ");
fprintf(fd, "at %d layer %d ", cmp->off, cmp->layer);
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 04/11] Fix wrong sanity check in choke_parse_opt()
From: Thomas Jarosch @ 2011-10-03 15:23 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
tc/q_choke.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tc/q_choke.c b/tc/q_choke.c
index 6e54cb7..04a864f 100644
--- a/tc/q_choke.c
+++ b/tc/q_choke.c
@@ -122,7 +122,7 @@ static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv,
return -1;
}
- if (opt.qth_min > opt.qth_min) {
+ if (opt.qth_min >= opt.qth_max) {
fprintf(stderr, "\"min\" is not smaller than \"max\"\n");
return -1;
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 08/11] Fix file descriptor leak on error in read_viftable()
From: Thomas Jarosch @ 2011-10-03 15:24 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/ipmroute.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index a4389f5..f033349 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -58,9 +58,10 @@ static void read_viftable(void)
if (!fp)
return;
- if (!fgets(buf, sizeof(buf), fp))
+ if (!fgets(buf, sizeof(buf), fp)) {
+ fclose(fp);
return;
-
+ }
while (fgets(buf, sizeof(buf), fp)) {
int vifi;
char dev[256];
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 06/11] Add missing closedir() call in do_show()
From: Thomas Jarosch @ 2011-10-03 15:23 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/iptuntap.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 588926c..29f2777 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -298,6 +298,7 @@ static int do_show(int argc, char **argv)
printf(" group %ld", group);
printf("\n");
}
+ closedir(dir);
return 0;
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 11/11] Fix file descriptor leak on error in read_igmp()
From: Thomas Jarosch @ 2011-10-03 15:24 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/ipmaddr.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 5a52c85..3ae9478 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -128,8 +128,10 @@ void read_igmp(struct ma_info **result_p)
if (!fp)
return;
memset(&m, 0, sizeof(m));
- if (!fgets(buf, sizeof(buf), fp))
+ if (!fgets(buf, sizeof(buf), fp)) {
+ fclose(fp);
return;
+ }
m.addr.family = AF_INET;
m.addr.bitlen = 32;
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 10/11] Fix file descriptor leak in do_tunnels_list()
From: Thomas Jarosch @ 2011-10-03 15:24 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/iptunnel.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index f038f0a..3d41a27 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -411,6 +411,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
if (!fgets(buf, sizeof(buf), fp) ||
!fgets(buf, sizeof(buf), fp)) {
fprintf(stderr, "/proc/net/dev read error\n");
+ fclose(fp);
return -1;
}
@@ -421,6 +422,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
if ((ptr = strchr(buf, ':')) == NULL ||
(*ptr++ = 0, sscanf(buf, "%s", name) != 1)) {
fprintf(stderr, "Wrong format of /proc/net/dev. Sorry.\n");
+ fclose(fp);
return -1;
}
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld",
@@ -462,6 +464,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
}
printf("\n");
}
+ fclose(fp);
return 0;
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 07/11] Fix file descriptor leak on error in iproute_flush_cache()
From: Thomas Jarosch @ 2011-10-03 15:23 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/iproute.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index 21e1a4b..15b36e8 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1057,6 +1057,7 @@ static int iproute_flush_cache(void)
if ((write (flush_fd, (void *)buffer, len)) < len) {
fprintf (stderr, "Cannot flush routing cache\n");
+ close(flush_fd);
return -1;
}
close(flush_fd);
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 09/11] Fix file descriptor leak on error in read_mroute_list()
From: Thomas Jarosch @ 2011-10-03 15:24 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
ip/ipmroute.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index f033349..945727d 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -85,8 +85,10 @@ static void read_mroute_list(FILE *ofp)
if (!fp)
return;
- if (!fgets(buf, sizeof(buf), fp))
+ if (!fgets(buf, sizeof(buf), fp)) {
+ fclose(fp);
return;
+ }
while (fgets(buf, sizeof(buf), fp)) {
inet_prefix maddr, msrc;
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 05/11] Fix memory leak of lname variable in get_target_name()
From: Thomas Jarosch @ 2011-10-03 15:23 UTC (permalink / raw)
To: netdev
Detected by cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
tc/m_ipt.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tc/m_ipt.c b/tc/m_ipt.c
index 99d9965..a73d400 100644
--- a/tc/m_ipt.c
+++ b/tc/m_ipt.c
@@ -281,6 +281,7 @@ get_target_name(const char *name)
fputs(dlerror(), stderr);
printf("\n");
free(new_name);
+ free(lname);
return NULL;
}
}
@@ -297,6 +298,7 @@ get_target_name(const char *name)
fprintf(stderr, "\n");
dlclose(handle);
free(new_name);
+ free(lname);
return NULL;
}
}
@@ -304,6 +306,7 @@ get_target_name(const char *name)
}
free(new_name);
+ free(lname);
return m;
}
--
1.7.4.4
^ permalink raw reply related
* [iproute2 PATCH 00/11] QA check with cppcheck
From: Thomas Jarosch @ 2011-10-03 15:21 UTC (permalink / raw)
To: netdev
Hi there,
I've given iproute2 a good run with the free
cppcheck static code analysis tool.
(http://cppcheck.sourceforge.net/)
Following are eleven patches correcting minor
resource leaks and two real bugs.
Cheers,
Thomas
Thomas Jarosch (11):
Fix pipe I/O stream descriptor leak in init_service_resolver()
Fix file descriptor leak on error in rtnl_hash_initialize()
Fix wrong comparison in cmp_print_eopt()
Fix wrong sanity check in choke_parse_opt()
Fix memory leak of lname variable in get_target_name()
Add missing closedir() call in do_show()
Fix file descriptor leak on error in iproute_flush_cache()
Fix file descriptor leak on error in read_viftable()
Fix file descriptor leak on error in read_mroute_list()
Fix file descriptor leak in do_tunnels_list()
Fix file descriptor leak on error in read_igmp()
ip/ipmaddr.c | 4 +++-
ip/ipmroute.c | 9 ++++++---
ip/iproute.c | 1 +
ip/iptunnel.c | 3 +++
ip/iptuntap.c | 1 +
lib/rt_names.c | 2 ++
misc/ss.c | 1 +
tc/em_cmp.c | 2 +-
tc/m_ipt.c | 3 +++
tc/q_choke.c | 2 +-
10 files changed, 22 insertions(+), 6 deletions(-)
--
1.7.4.4
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox