Florian Westphal
4cf0b354d9
rhashtable: avoid large lock-array allocations
...
Sander reports following splat after netfilter nat bysrc table got
converted to rhashtable:
swapper/0: page allocation failure: order:3, mode:0x2084020(GFP_ATOMIC|__GFP_COMP)
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc1 [..]
[<ffffffff811633ed>] warn_alloc_failed+0xdd/0x140
[<ffffffff811638b1>] __alloc_pages_nodemask+0x3e1/0xcf0
[<ffffffff811a72ed>] alloc_pages_current+0x8d/0x110
[<ffffffff8117cb7f>] kmalloc_order+0x1f/0x70
[<ffffffff811aec19>] __kmalloc+0x129/0x140
[<ffffffff8146d561>] bucket_table_alloc+0xc1/0x1d0
[<ffffffff8146da1d>] rhashtable_insert_rehash+0x5d/0xe0
[<ffffffff819fcfff>] nf_nat_setup_info+0x2ef/0x400
The failure happens when allocating the spinlock array.
Even with GFP_KERNEL its unlikely for such a large allocation
to succeed.
Thomas Graf pointed me at inet_ehash_locks_alloc(), so in addition
to adding NOWARN for atomic allocations this also makes the bucket-array
sizing more conservative.
In commit 095dc8e0c3 ("tcp: fix/cleanup inet_ehash_locks_alloc()"),
Eric Dumazet says: "Budget 2 cache lines per cpu worth of 'spinlocks'".
IOW, consider size needed by a single spinlock when determining
number of locks per cpu. So with 64 byte per cacheline and 4 byte per
spinlock this gives 32 locks per cpu.
Resulting size of the lock-array (sizeof(spinlock) == 4):
cpus: 1 2 4 8 16 32 64
old: 1k 1k 4k 8k 16k 16k 16k
new: 128 256 512 1k 2k 4k 8k
8k allocation should have decent chance of success even
with GFP_ATOMIC, and should not fail with GFP_KERNEL.
With 72-byte spinlock (LOCKDEP):
cpus : 1 2
old: 9k 18k
new: ~2k ~4k
Reported-by: Sander Eikelenboom <linux@eikelenboom.it >
Suggested-by: Thomas Graf <tgraf@suug.ch >
Signed-off-by: Florian Westphal <fw@strlen.de >
Signed-off-by: David S. Miller <davem@davemloft.net >
2016-08-14 21:12:57 -07:00
..
2016-03-17 21:38:27 -07:00
2014-10-09 11:35:48 +03:00
2016-04-13 09:22:49 -07:00
2014-09-28 11:08:01 +02:00
2016-07-29 18:30:16 +08:00
2015-12-01 13:52:25 +11:00
2014-06-04 16:54:18 -07:00
2015-09-10 13:29:01 -07:00
2014-08-06 18:01:24 -07:00
2012-10-08 13:50:18 +10:30
2013-04-29 18:28:19 -07:00
2016-05-17 09:33:39 -07:00
2016-04-06 14:06:48 +01:00
locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
2016-06-16 10:48:32 +02:00
locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
2016-06-16 10:48:32 +02:00
2014-12-13 12:42:51 -08:00
2012-09-10 11:13:16 -07:00
2011-03-11 14:25:50 +00:00
2016-07-15 10:26:30 +02:00
2014-12-22 16:43:06 +00:00
2012-03-07 15:04:04 -05:00
2015-11-23 09:44:58 +01:00
2016-03-17 15:09:34 -07:00
2013-06-19 17:54:06 +02:00
2013-03-22 16:41:20 -07:00
2016-07-03 00:57:23 -04:00
2012-03-07 15:04:04 -05:00
2016-03-13 23:55:13 -04:00
2014-04-03 16:21:12 -07:00
2012-02-02 10:34:23 +11:00
2014-10-03 18:40:58 +01:00
2014-03-20 10:11:35 -04:00
2011-10-29 21:20:22 +02:00
2015-05-27 15:22:15 +02:00
2012-07-30 17:25:22 -07:00
2016-02-29 09:35:20 +01:00
2014-05-16 14:26:52 -04:00
2011-06-03 15:01:06 -04:00
2016-08-02 19:35:08 -04:00
2012-03-23 16:58:38 -07:00
2015-05-26 15:26:43 +02:00
2015-05-30 22:42:24 -07:00
2012-03-07 15:04:04 -05:00
2015-06-11 15:08:32 +02:00
2013-06-26 12:10:56 +02:00
2016-05-19 19:12:14 -07:00
2012-03-07 15:04:04 -05:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-07-17 16:39:54 -07:00
2016-02-07 23:17:59 -08:00
2016-05-31 16:42:00 +08:00
2015-11-16 14:42:12 -05:00
2016-07-26 16:19:19 -07:00
2016-03-02 17:01:55 +02:00
2016-02-05 18:10:40 -08:00
2016-01-04 10:26:58 -05:00
2015-02-12 18:54:15 -08:00
2016-06-08 11:04:19 +02:00
2016-02-24 14:57:26 +00:00
2015-10-23 17:55:10 +09:00
2014-04-30 19:49:37 +01:00
2012-07-23 13:54:52 +01:00
2012-07-23 13:54:52 +01:00
2012-07-23 13:54:52 +01:00
2012-07-23 13:54:52 +01:00
2012-07-23 13:54:52 +01:00
2012-07-23 13:54:52 +01:00
2015-04-17 09:03:54 -04:00
2014-01-21 23:17:20 -08:00
2016-02-15 11:18:23 +01:00
2016-05-20 17:58:30 -07:00
2015-02-13 21:21:35 -08:00
2015-12-22 17:10:18 -06:00
2014-08-06 18:01:25 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2016-06-08 15:01:02 +02:00
2015-11-06 17:50:42 -08:00
2013-04-29 18:28:19 -07:00
2014-05-05 09:09:14 +02:00
2015-02-12 18:54:15 -08:00
2016-01-20 17:09:18 -08:00
2014-04-07 16:36:11 -07:00
2015-11-05 16:34:48 -08:00
2016-08-02 19:35:07 -04:00
2015-04-14 16:49:04 -07:00
2016-07-28 16:07:41 -07:00
2016-01-19 15:26:55 -05:00
2012-03-07 15:04:04 -05:00
2015-11-06 17:50:42 -08:00
2012-05-02 00:04:06 -07:00
2016-01-16 11:17:27 -08:00
2016-05-20 17:58:30 -07:00
2016-08-02 21:08:07 -04:00
2016-07-28 16:07:41 -07:00
2016-05-23 17:04:14 -07:00
2016-03-22 15:36:02 -07:00
2014-08-08 15:57:25 -07:00
2016-02-07 22:18:47 -08:00
2015-02-12 18:54:15 -08:00
2016-02-09 17:36:34 -08:00
2016-03-17 15:09:34 -07:00
2011-10-31 17:30:56 -07:00
2015-03-31 09:45:50 -06:00
2016-01-22 11:58:43 -08:00
2016-03-09 15:43:42 -08:00
2015-06-16 14:12:35 -04:00
2015-11-06 17:50:42 -08:00
2014-10-03 06:09:30 +02:00
2015-08-12 11:59:04 +02:00
2015-11-25 09:22:02 -07:00
2016-07-27 15:11:55 -07:00
2015-02-12 18:54:15 -08:00
2012-07-30 17:25:22 -07:00
2012-07-30 17:25:16 -07:00
2014-06-25 17:45:43 -07:00
2015-12-03 11:49:23 -05:00
2016-04-23 20:13:24 -04:00
2016-05-20 17:58:30 -07:00
2016-05-19 19:12:14 -07:00
2013-04-09 14:13:05 -04:00
2012-07-30 17:25:22 -07:00
2012-12-14 10:32:52 +11:00
2013-05-05 14:38:00 -07:00
2015-10-08 05:26:36 -07:00
2014-01-23 16:36:55 -08:00
2015-09-08 14:35:59 -07:00
2016-05-19 19:12:14 -07:00
2015-11-06 17:50:42 -08:00
2013-11-13 12:09:11 +09:00
2016-02-15 11:18:23 +01:00
2015-02-12 18:54:16 -08:00
2012-07-30 17:25:22 -07:00
2016-08-02 17:31:41 -04:00
2016-07-07 10:35:09 +02:00
2016-08-02 19:35:06 -04:00
2012-05-17 15:18:37 +02:00
2014-01-23 16:37:03 -08:00
2016-07-06 10:51:14 +01:00
2014-01-21 23:17:20 -08:00
2016-08-14 21:12:57 -07:00
2016-02-08 10:15:17 -08:00
2015-12-23 14:27:20 -05:00
2016-04-15 16:53:14 -04:00
2015-08-24 14:28:01 -06:00
2015-03-23 22:12:08 -04:00
2015-09-08 15:35:28 -07:00
2014-04-07 16:36:14 -07:00
2015-06-25 17:00:40 -07:00
2016-07-28 16:07:41 -07:00
2015-02-12 18:54:16 -08:00
2016-04-21 10:47:26 +10:00
2016-03-17 15:09:34 -07:00
2016-05-20 17:58:30 -07:00
2015-12-17 10:05:19 -08:00
2015-06-25 15:22:36 -07:00
2014-04-03 16:21:06 -07:00
2016-02-19 22:54:09 -05:00
2016-05-16 13:49:32 -04:00
2016-01-07 13:44:22 -07:00
2016-06-10 20:21:46 -07:00
2016-01-20 17:09:18 -08:00
2016-05-20 17:58:30 -07:00
2014-01-23 16:36:57 -08:00
2016-03-15 16:55:16 -07:00
2016-08-08 12:52:42 -07:00
2015-08-03 11:51:12 +02:00
2016-02-09 10:27:29 +01:00
2014-01-23 16:36:57 -08:00
2016-05-30 15:26:57 -07:00
2015-09-10 13:29:01 -07:00
2016-02-03 08:28:43 -08:00
2014-10-14 02:18:14 +02:00
2015-04-22 17:06:49 +02:00
2016-08-02 17:31:41 -04:00
2016-01-20 17:09:18 -08:00
2016-02-16 12:49:05 +00:00
2013-04-30 17:04:09 -07:00
2016-05-30 15:26:57 -07:00
2016-05-20 17:58:30 -07:00