aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-07-24 10:50:37 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-28 01:34:36 -0400
commit1bab4c75075b84675b96992ac47580a57c26958d (patch)
treed015ddcf9d9d16e423efb63e9ddbd46fb02d95c3 /net/ieee802154
parentab1c724f633080ed2e8a0cfe61654599b55cf8f9 (diff)
inet: frag: set limits and make init_net's high_thresh limit global
This patch makes init_net's high_thresh limit to be the maximum for all namespaces, thus introducing a global memory limit threshold equal to the sum of the individual high_thresh limits which are capped. It also introduces some sane minimums for low_thresh as it shouldn't be able to drop below 0 (or > high_thresh in the unsigned case), and overall low_thresh should not ever be above high_thresh, so we make the following relations for a namespace: init_net: high_thresh - max(not capped), min(init_net low_thresh) low_thresh - max(init_net high_thresh), min (0) all other namespaces: high_thresh = max(init_net high_thresh), min(namespace's low_thresh) low_thresh = max(namespace's high_thresh), min(0) The major issue with having low_thresh > high_thresh is that we'll schedule eviction but never evict anything and thus rely only on the timers. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/reassembly.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index 8da635d92a58..f13d4f32e207 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -386,20 +386,25 @@ err:
386EXPORT_SYMBOL(lowpan_frag_rcv); 386EXPORT_SYMBOL(lowpan_frag_rcv);
387 387
388#ifdef CONFIG_SYSCTL 388#ifdef CONFIG_SYSCTL
389static int zero;
390
389static struct ctl_table lowpan_frags_ns_ctl_table[] = { 391static struct ctl_table lowpan_frags_ns_ctl_table[] = {
390 { 392 {
391 .procname = "6lowpanfrag_high_thresh", 393 .procname = "6lowpanfrag_high_thresh",
392 .data = &init_net.ieee802154_lowpan.frags.high_thresh, 394 .data = &init_net.ieee802154_lowpan.frags.high_thresh,
393 .maxlen = sizeof(int), 395 .maxlen = sizeof(int),
394 .mode = 0644, 396 .mode = 0644,
395 .proc_handler = proc_dointvec 397 .proc_handler = proc_dointvec_minmax,
398 .extra1 = &init_net.ieee802154_lowpan.frags.low_thresh
396 }, 399 },
397 { 400 {
398 .procname = "6lowpanfrag_low_thresh", 401 .procname = "6lowpanfrag_low_thresh",
399 .data = &init_net.ieee802154_lowpan.frags.low_thresh, 402 .data = &init_net.ieee802154_lowpan.frags.low_thresh,
400 .maxlen = sizeof(int), 403 .maxlen = sizeof(int),
401 .mode = 0644, 404 .mode = 0644,
402 .proc_handler = proc_dointvec 405 .proc_handler = proc_dointvec_minmax,
406 .extra1 = &zero,
407 .extra2 = &init_net.ieee802154_lowpan.frags.high_thresh
403 }, 408 },
404 { 409 {
405 .procname = "6lowpanfrag_time", 410 .procname = "6lowpanfrag_time",
@@ -446,7 +451,10 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
446 goto err_alloc; 451 goto err_alloc;
447 452
448 table[0].data = &ieee802154_lowpan->frags.high_thresh; 453 table[0].data = &ieee802154_lowpan->frags.high_thresh;
454 table[0].extra1 = &ieee802154_lowpan->frags.low_thresh;
455 table[0].extra2 = &init_net.ieee802154_lowpan.frags.high_thresh;
449 table[1].data = &ieee802154_lowpan->frags.low_thresh; 456 table[1].data = &ieee802154_lowpan->frags.low_thresh;
457 table[1].extra2 = &ieee802154_lowpan->frags.high_thresh;
450 table[2].data = &ieee802154_lowpan->frags.timeout; 458 table[2].data = &ieee802154_lowpan->frags.timeout;
451 table[3].data = &ieee802154_lowpan->max_dsize; 459 table[3].data = &ieee802154_lowpan->max_dsize;
452 460