* [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL
@ 2010-06-30 21:59 Brian King
2010-07-02 5:48 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Brian King @ 2010-06-30 21:59 UTC (permalink / raw)
To: ossthema; +Cc: osstklei, raisch, netdev, brking
Since ehea_get_stats calls ehea_h_query_ehea_port, which
can sleep, we can also sleep when allocating a page in
this function. This fixes some memory allocation failure
warnings seen under low memory conditions.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
drivers/net/ehea/ehea_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN drivers/net/ehea/ehea_main.c~ehea_get_stats_gfp drivers/net/ehea/ehea_main.c
--- linux-2.6/drivers/net/ehea/ehea_main.c~ehea_get_stats_gfp 2010-06-28 09:46:51.000000000 -0500
+++ linux-2.6-bjking1/drivers/net/ehea/ehea_main.c 2010-06-28 09:46:51.000000000 -0500
@@ -335,7 +335,7 @@ static struct net_device_stats *ehea_get
memset(stats, 0, sizeof(*stats));
- cb2 = (void *)get_zeroed_page(GFP_ATOMIC);
+ cb2 = (void *)get_zeroed_page(GFP_KERNEL);
if (!cb2) {
ehea_error("no mem for cb2");
goto out;
_
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL
2010-06-30 21:59 [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL Brian King
@ 2010-07-02 5:48 ` David Miller
2010-08-18 14:10 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2010-07-02 5:48 UTC (permalink / raw)
To: brking; +Cc: ossthema, osstklei, raisch, netdev
From: Brian King <brking@linux.vnet.ibm.com>
Date: Wed, 30 Jun 2010 16:59:12 -0500
>
> Since ehea_get_stats calls ehea_h_query_ehea_port, which
> can sleep, we can also sleep when allocating a page in
> this function. This fixes some memory allocation failure
> warnings seen under low memory conditions.
>
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Applied to net-next-2.6
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL
2010-07-02 5:48 ` David Miller
@ 2010-08-18 14:10 ` Eric Dumazet
2010-08-18 17:49 ` Jay Vosburgh
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2010-08-18 14:10 UTC (permalink / raw)
To: David Miller; +Cc: brking, ossthema, osstklei, raisch, netdev, Jay Vosburgh
Le jeudi 01 juillet 2010 à 22:48 -0700, David Miller a écrit :
> From: Brian King <brking@linux.vnet.ibm.com>
> Date: Wed, 30 Jun 2010 16:59:12 -0500
>
> >
> > Since ehea_get_stats calls ehea_h_query_ehea_port, which
> > can sleep, we can also sleep when allocating a page in
> > this function. This fixes some memory allocation failure
> > warnings seen under low memory conditions.
> >
> > Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
>
> Applied to net-next-2.6
> --
I believe there is a problem with this patch and/or bonding.
If we say ndo_get_stats() methods are allowed to sleep, then
bond_get_stats() should be updated, because it currently calls
dev_get_stats() from a read_lock_bh(&bond->lock); section.
Are we allowed to sleep inside a read_lock_bh() ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL
2010-08-18 14:10 ` Eric Dumazet
@ 2010-08-18 17:49 ` Jay Vosburgh
2010-08-19 7:53 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Jay Vosburgh @ 2010-08-18 17:49 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, brking, ossthema, osstklei, raisch, netdev
Eric Dumazet <eric.dumazet@gmail.com> wrote:
>Le jeudi 01 juillet 2010 à 22:48 -0700, David Miller a écrit :
>> From: Brian King <brking@linux.vnet.ibm.com>
>> Date: Wed, 30 Jun 2010 16:59:12 -0500
>>
>> >
>> > Since ehea_get_stats calls ehea_h_query_ehea_port, which
>> > can sleep, we can also sleep when allocating a page in
>> > this function. This fixes some memory allocation failure
>> > warnings seen under low memory conditions.
>> >
>> > Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
>>
>> Applied to net-next-2.6
>> --
>
>I believe there is a problem with this patch and/or bonding.
>
>If we say ndo_get_stats() methods are allowed to sleep, then
>bond_get_stats() should be updated, because it currently calls
>dev_get_stats() from a read_lock_bh(&bond->lock); section.
>
>Are we allowed to sleep inside a read_lock_bh() ?
Nope.
And bonding's not the only call site that holds a lock over the
call to ndo_get_stats / dev_get_stats; net/core/net-sysfs.c:netstat_show
does it as well.
I presume that bonding and netstat_show are holding a lock to
keep a list of interfaces from changing, since there's no other locking
that's guaranteed to be held for a call to dev_get_stats.
In any event, ehea is doing an hcall to the hypervisor, which
may return "long busy," after which ehea sleeps for however long the
hypervisor told it to wait before trying again.
So, the real question is whether the ndo_get_stats* functions
are permitted to sleep. If they are, then bonding and netstat_show both
need to change. If not, then ehea needs to change. Ehea is probably
not alone in this; I poked around a bit, and it looks like mlx4 may also
sleep in ndo_get_stats.
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL
2010-08-18 17:49 ` Jay Vosburgh
@ 2010-08-19 7:53 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-08-19 7:53 UTC (permalink / raw)
To: fubar; +Cc: eric.dumazet, brking, ossthema, osstklei, raisch, netdev
From: Jay Vosburgh <fubar@us.ibm.com>
Date: Wed, 18 Aug 2010 10:49:41 -0700
> So, the real question is whether the ndo_get_stats* functions
> are permitted to sleep. If they are, then bonding and netstat_show both
> need to change. If not, then ehea needs to change. Ehea is probably
> not alone in this; I poked around a bit, and it looks like mlx4 may also
> sleep in ndo_get_stats.
They really can't currently.... so EHEA will need to be changed
such that it can do stats fetching atomically.
In the long term, we could allow this.
The netstat_stat function should be RCU'able. And something
similar, I suppose, should be possible on the bonding side.
But as it stands EHEA has to be fixed and can't stay as-is.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-19 7:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 21:59 [PATCH 1/1] ehea: Allocate stats buffer with GFP_KERNEL Brian King
2010-07-02 5:48 ` David Miller
2010-08-18 14:10 ` Eric Dumazet
2010-08-18 17:49 ` Jay Vosburgh
2010-08-19 7:53 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).