From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: David Miller <davem@davemloft.net>,
mingo@elte.hu, sri@us.ibm.com, herbert@gondor.apana.org.au,
torvalds@linux-foundation.org, sjayaraman@suse.de,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: nfs broken in net-next? -- now in mainline -- bisected: d9f5950f90292f7cc42834338dfd5f44dc4cc4ca
Date: Sun, 13 Dec 2009 17:57:08 +0100 [thread overview]
Message-ID: <4B251CE4.9080401@gmail.com> (raw)
In-Reply-To: <86802c440912121841j34cde8ecv892d7d74a32313ac@mail.gmail.com>
Le 13/12/2009 03:41, Yinghai Lu a écrit :
>
>>> cause the problem: nfs mount fail.
>>>
>>> the setup is:
>>> 64bit kernel, have all needed drivers in kernel, and boot with
>>> ip=dhcp, root disk is 256M ramdisk.
>>> then try to mount nfs....
>>>
>>
>> change entries default value from 65536 to 256,
>> nfs mount will work.
>>
> interesting:
>
> m:~/dump # grep UDP dmesg.txt
> [ 28.996034] UDP hash table entries: 65536 (order: 11, 10485760 bytes)
> [ 29.032364] UDP-Lite hash table entries: 65536 (order: 11, 10485760 bytes)
>
> will not work
>
> but 32768 will work.
Thanks a lot for this work Yinghai !
This last bit helped me a lot ...
Hmm, udp_lib_get_port() assumes it can loop at least one time in :
for (last = first + udptable->mask + 1;
first != last;
first++) {
// unit_work
}
but if udptable->mask == 65535, loop is not entered at all (since last == first)
We should convert it to a do { } while(...); construct, or use 32bit variables
and (u16) casts.
Thanks
[PATCH] udp: udp_lib_get_port() fix
Now we can have a large udp hash table, udp_lib_get_port() loop
should be converted to a do {} while (cond) form,
or we dont enter it at all if hash table size is exactly 65536.
Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1f95348..f0126fd 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -216,9 +216,8 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
* force rand to be an odd multiple of UDP_HTABLE_SIZE
*/
rand = (rand | 1) * (udptable->mask + 1);
- for (last = first + udptable->mask + 1;
- first != last;
- first++) {
+ last = first + udptable->mask + 1;
+ do {
hslot = udp_hashslot(udptable, net, first);
bitmap_zero(bitmap, PORTS_PER_CHAIN);
spin_lock_bh(&hslot->lock);
@@ -238,7 +237,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
snum += rand;
} while (snum != first);
spin_unlock_bh(&hslot->lock);
- }
+ } while (++first != last);
goto fail;
} else {
hslot = udp_hashslot(udptable, net, snum);
next prev parent reply other threads:[~2009-12-13 16:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-12 5:25 nfs broken in net-next? -- now in mainline -- bisected: d9f5950f90292f7cc42834338dfd5f44dc4cc4ca Yinghai Lu
2009-12-12 5:41 ` David Miller
2009-12-13 1:05 ` Yinghai Lu
2009-12-13 1:57 ` Yinghai Lu
2009-12-13 2:25 ` Yinghai Lu
2009-12-13 2:41 ` Yinghai Lu
2009-12-13 16:57 ` Eric Dumazet [this message]
2009-12-13 22:28 ` Yinghai Lu
2009-12-14 3:33 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B251CE4.9080401@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=sjayaraman@suse.de \
--cc=sri@us.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).