From: kbuild test robot <lkp@intel.com> To: Arun KS <arunks@codeaurora.org> Cc: kbuild-all@01.org, akpm@linux-foundation.org, keescook@chromium.org, khlebnikov@yandex-team.ru, minchan@kernel.org, mhocko@kernel.org, vbabka@suse.cz, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, getarunks@gmail.com, Arun KS <arunks@codeaurora.org> Subject: Re: [PATCH v3 1/4] mm: reference totalram_pages and managed_pages once per function Date: Fri, 9 Nov 2018 19:33:41 +0800 [thread overview] Message-ID: <201811091945.Ue9XXc0x%fengguang.wu@intel.com> (raw) In-Reply-To: <1541665398-29925-2-git-send-email-arunks@codeaurora.org> [-- Attachment #1: Type: text/plain, Size: 8435 bytes --] Hi Arun, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.20-rc1 next-20181109] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Arun-KS/mm-convert-totalram_pages-totalhigh_pages-and-managed-pages-to-atomic/20181109-184653 config: i386-randconfig-x003-201844 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): net//sctp/protocol.c: In function 'sctp_init': >> net//sctp/protocol.c:1430:5: warning: 'totalram_pgs' may be used uninitialized in this function [-Wmaybe-uninitialized] if (totalram_pgs >= (128 * 1024)) ^ vim +/totalram_pgs +1430 net//sctp/protocol.c 1363 1364 /* Initialize the universe into something sensible. */ 1365 static __init int sctp_init(void) 1366 { 1367 int i; 1368 int status = -EINVAL; 1369 unsigned long goal; 1370 unsigned long limit; 1371 unsigned long totalram_pgs; 1372 int max_share; 1373 int order; 1374 int num_entries; 1375 int max_entry_order; 1376 1377 sock_skb_cb_check_size(sizeof(struct sctp_ulpevent)); 1378 1379 /* Allocate bind_bucket and chunk caches. */ 1380 status = -ENOBUFS; 1381 sctp_bucket_cachep = kmem_cache_create("sctp_bind_bucket", 1382 sizeof(struct sctp_bind_bucket), 1383 0, SLAB_HWCACHE_ALIGN, 1384 NULL); 1385 if (!sctp_bucket_cachep) 1386 goto out; 1387 1388 sctp_chunk_cachep = kmem_cache_create("sctp_chunk", 1389 sizeof(struct sctp_chunk), 1390 0, SLAB_HWCACHE_ALIGN, 1391 NULL); 1392 if (!sctp_chunk_cachep) 1393 goto err_chunk_cachep; 1394 1395 status = percpu_counter_init(&sctp_sockets_allocated, 0, GFP_KERNEL); 1396 if (status) 1397 goto err_percpu_counter_init; 1398 1399 /* Implementation specific variables. */ 1400 1401 /* Initialize default stream count setup information. */ 1402 sctp_max_instreams = SCTP_DEFAULT_INSTREAMS; 1403 sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS; 1404 1405 /* Initialize handle used for association ids. */ 1406 idr_init(&sctp_assocs_id); 1407 1408 limit = nr_free_buffer_pages() / 8; 1409 limit = max(limit, 128UL); 1410 sysctl_sctp_mem[0] = limit / 4 * 3; 1411 sysctl_sctp_mem[1] = limit; 1412 sysctl_sctp_mem[2] = sysctl_sctp_mem[0] * 2; 1413 1414 /* Set per-socket limits to no more than 1/128 the pressure threshold*/ 1415 limit = (sysctl_sctp_mem[1]) << (PAGE_SHIFT - 7); 1416 max_share = min(4UL*1024*1024, limit); 1417 1418 sysctl_sctp_rmem[0] = SK_MEM_QUANTUM; /* give each asoc 1 page min */ 1419 sysctl_sctp_rmem[1] = 1500 * SKB_TRUESIZE(1); 1420 sysctl_sctp_rmem[2] = max(sysctl_sctp_rmem[1], max_share); 1421 1422 sysctl_sctp_wmem[0] = SK_MEM_QUANTUM; 1423 sysctl_sctp_wmem[1] = 16*1024; 1424 sysctl_sctp_wmem[2] = max(64*1024, max_share); 1425 1426 /* Size and allocate the association hash table. 1427 * The methodology is similar to that of the tcp hash tables. 1428 * Though not identical. Start by getting a goal size 1429 */ > 1430 if (totalram_pgs >= (128 * 1024)) 1431 goal = totalram_pgs >> (22 - PAGE_SHIFT); 1432 else 1433 goal = totalram_pgs >> (24 - PAGE_SHIFT); 1434 1435 /* Then compute the page order for said goal */ 1436 order = get_order(goal); 1437 1438 /* Now compute the required page order for the maximum sized table we 1439 * want to create 1440 */ 1441 max_entry_order = get_order(MAX_SCTP_PORT_HASH_ENTRIES * 1442 sizeof(struct sctp_bind_hashbucket)); 1443 1444 /* Limit the page order by that maximum hash table size */ 1445 order = min(order, max_entry_order); 1446 1447 /* Allocate and initialize the endpoint hash table. */ 1448 sctp_ep_hashsize = 64; 1449 sctp_ep_hashtable = 1450 kmalloc_array(64, sizeof(struct sctp_hashbucket), GFP_KERNEL); 1451 if (!sctp_ep_hashtable) { 1452 pr_err("Failed endpoint_hash alloc\n"); 1453 status = -ENOMEM; 1454 goto err_ehash_alloc; 1455 } 1456 for (i = 0; i < sctp_ep_hashsize; i++) { 1457 rwlock_init(&sctp_ep_hashtable[i].lock); 1458 INIT_HLIST_HEAD(&sctp_ep_hashtable[i].chain); 1459 } 1460 1461 /* Allocate and initialize the SCTP port hash table. 1462 * Note that order is initalized to start at the max sized 1463 * table we want to support. If we can't get that many pages 1464 * reduce the order and try again 1465 */ 1466 do { 1467 sctp_port_hashtable = (struct sctp_bind_hashbucket *) 1468 __get_free_pages(GFP_KERNEL | __GFP_NOWARN, order); 1469 } while (!sctp_port_hashtable && --order > 0); 1470 1471 if (!sctp_port_hashtable) { 1472 pr_err("Failed bind hash alloc\n"); 1473 status = -ENOMEM; 1474 goto err_bhash_alloc; 1475 } 1476 1477 /* Now compute the number of entries that will fit in the 1478 * port hash space we allocated 1479 */ 1480 num_entries = (1UL << order) * PAGE_SIZE / 1481 sizeof(struct sctp_bind_hashbucket); 1482 1483 /* And finish by rounding it down to the nearest power of two 1484 * this wastes some memory of course, but its needed because 1485 * the hash function operates based on the assumption that 1486 * that the number of entries is a power of two 1487 */ 1488 sctp_port_hashsize = rounddown_pow_of_two(num_entries); 1489 1490 for (i = 0; i < sctp_port_hashsize; i++) { 1491 spin_lock_init(&sctp_port_hashtable[i].lock); 1492 INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); 1493 } 1494 1495 status = sctp_transport_hashtable_init(); 1496 if (status) 1497 goto err_thash_alloc; 1498 1499 pr_info("Hash tables configured (bind %d/%d)\n", sctp_port_hashsize, 1500 num_entries); 1501 1502 sctp_sysctl_register(); 1503 1504 INIT_LIST_HEAD(&sctp_address_families); 1505 sctp_v4_pf_init(); 1506 sctp_v6_pf_init(); 1507 sctp_sched_ops_init(); 1508 1509 status = register_pernet_subsys(&sctp_defaults_ops); 1510 if (status) 1511 goto err_register_defaults; 1512 1513 status = sctp_v4_protosw_init(); 1514 if (status) 1515 goto err_protosw_init; 1516 1517 status = sctp_v6_protosw_init(); 1518 if (status) 1519 goto err_v6_protosw_init; 1520 1521 status = register_pernet_subsys(&sctp_ctrlsock_ops); 1522 if (status) 1523 goto err_register_ctrlsock; 1524 1525 status = sctp_v4_add_protocol(); 1526 if (status) 1527 goto err_add_protocol; 1528 1529 /* Register SCTP with inet6 layer. */ 1530 status = sctp_v6_add_protocol(); 1531 if (status) 1532 goto err_v6_add_protocol; 1533 1534 if (sctp_offload_init() < 0) 1535 pr_crit("%s: Cannot add SCTP protocol offload\n", __func__); 1536 1537 out: 1538 return status; 1539 err_v6_add_protocol: 1540 sctp_v4_del_protocol(); 1541 err_add_protocol: 1542 unregister_pernet_subsys(&sctp_ctrlsock_ops); 1543 err_register_ctrlsock: 1544 sctp_v6_protosw_exit(); 1545 err_v6_protosw_init: 1546 sctp_v4_protosw_exit(); 1547 err_protosw_init: 1548 unregister_pernet_subsys(&sctp_defaults_ops); 1549 err_register_defaults: 1550 sctp_v4_pf_exit(); 1551 sctp_v6_pf_exit(); 1552 sctp_sysctl_unregister(); 1553 free_pages((unsigned long)sctp_port_hashtable, 1554 get_order(sctp_port_hashsize * 1555 sizeof(struct sctp_bind_hashbucket))); 1556 err_bhash_alloc: 1557 sctp_transport_hashtable_destroy(); 1558 err_thash_alloc: 1559 kfree(sctp_ep_hashtable); 1560 err_ehash_alloc: 1561 percpu_counter_destroy(&sctp_sockets_allocated); 1562 err_percpu_counter_init: 1563 kmem_cache_destroy(sctp_chunk_cachep); 1564 err_chunk_cachep: 1565 kmem_cache_destroy(sctp_bucket_cachep); 1566 goto out; 1567 } 1568 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 30674 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com> To: Arun KS <arunks@codeaurora.org> Cc: kbuild-all@01.org, akpm@linux-foundation.org, keescook@chromium.org, khlebnikov@yandex-team.ru, minchan@kernel.org, mhocko@kernel.org, vbabka@suse.cz, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, getarunks@gmail.com Subject: Re: [PATCH v3 1/4] mm: reference totalram_pages and managed_pages once per function Date: Fri, 9 Nov 2018 19:33:41 +0800 [thread overview] Message-ID: <201811091945.Ue9XXc0x%fengguang.wu@intel.com> (raw) In-Reply-To: <1541665398-29925-2-git-send-email-arunks@codeaurora.org> [-- Attachment #1: Type: text/plain, Size: 8435 bytes --] Hi Arun, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.20-rc1 next-20181109] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Arun-KS/mm-convert-totalram_pages-totalhigh_pages-and-managed-pages-to-atomic/20181109-184653 config: i386-randconfig-x003-201844 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): net//sctp/protocol.c: In function 'sctp_init': >> net//sctp/protocol.c:1430:5: warning: 'totalram_pgs' may be used uninitialized in this function [-Wmaybe-uninitialized] if (totalram_pgs >= (128 * 1024)) ^ vim +/totalram_pgs +1430 net//sctp/protocol.c 1363 1364 /* Initialize the universe into something sensible. */ 1365 static __init int sctp_init(void) 1366 { 1367 int i; 1368 int status = -EINVAL; 1369 unsigned long goal; 1370 unsigned long limit; 1371 unsigned long totalram_pgs; 1372 int max_share; 1373 int order; 1374 int num_entries; 1375 int max_entry_order; 1376 1377 sock_skb_cb_check_size(sizeof(struct sctp_ulpevent)); 1378 1379 /* Allocate bind_bucket and chunk caches. */ 1380 status = -ENOBUFS; 1381 sctp_bucket_cachep = kmem_cache_create("sctp_bind_bucket", 1382 sizeof(struct sctp_bind_bucket), 1383 0, SLAB_HWCACHE_ALIGN, 1384 NULL); 1385 if (!sctp_bucket_cachep) 1386 goto out; 1387 1388 sctp_chunk_cachep = kmem_cache_create("sctp_chunk", 1389 sizeof(struct sctp_chunk), 1390 0, SLAB_HWCACHE_ALIGN, 1391 NULL); 1392 if (!sctp_chunk_cachep) 1393 goto err_chunk_cachep; 1394 1395 status = percpu_counter_init(&sctp_sockets_allocated, 0, GFP_KERNEL); 1396 if (status) 1397 goto err_percpu_counter_init; 1398 1399 /* Implementation specific variables. */ 1400 1401 /* Initialize default stream count setup information. */ 1402 sctp_max_instreams = SCTP_DEFAULT_INSTREAMS; 1403 sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS; 1404 1405 /* Initialize handle used for association ids. */ 1406 idr_init(&sctp_assocs_id); 1407 1408 limit = nr_free_buffer_pages() / 8; 1409 limit = max(limit, 128UL); 1410 sysctl_sctp_mem[0] = limit / 4 * 3; 1411 sysctl_sctp_mem[1] = limit; 1412 sysctl_sctp_mem[2] = sysctl_sctp_mem[0] * 2; 1413 1414 /* Set per-socket limits to no more than 1/128 the pressure threshold*/ 1415 limit = (sysctl_sctp_mem[1]) << (PAGE_SHIFT - 7); 1416 max_share = min(4UL*1024*1024, limit); 1417 1418 sysctl_sctp_rmem[0] = SK_MEM_QUANTUM; /* give each asoc 1 page min */ 1419 sysctl_sctp_rmem[1] = 1500 * SKB_TRUESIZE(1); 1420 sysctl_sctp_rmem[2] = max(sysctl_sctp_rmem[1], max_share); 1421 1422 sysctl_sctp_wmem[0] = SK_MEM_QUANTUM; 1423 sysctl_sctp_wmem[1] = 16*1024; 1424 sysctl_sctp_wmem[2] = max(64*1024, max_share); 1425 1426 /* Size and allocate the association hash table. 1427 * The methodology is similar to that of the tcp hash tables. 1428 * Though not identical. Start by getting a goal size 1429 */ > 1430 if (totalram_pgs >= (128 * 1024)) 1431 goal = totalram_pgs >> (22 - PAGE_SHIFT); 1432 else 1433 goal = totalram_pgs >> (24 - PAGE_SHIFT); 1434 1435 /* Then compute the page order for said goal */ 1436 order = get_order(goal); 1437 1438 /* Now compute the required page order for the maximum sized table we 1439 * want to create 1440 */ 1441 max_entry_order = get_order(MAX_SCTP_PORT_HASH_ENTRIES * 1442 sizeof(struct sctp_bind_hashbucket)); 1443 1444 /* Limit the page order by that maximum hash table size */ 1445 order = min(order, max_entry_order); 1446 1447 /* Allocate and initialize the endpoint hash table. */ 1448 sctp_ep_hashsize = 64; 1449 sctp_ep_hashtable = 1450 kmalloc_array(64, sizeof(struct sctp_hashbucket), GFP_KERNEL); 1451 if (!sctp_ep_hashtable) { 1452 pr_err("Failed endpoint_hash alloc\n"); 1453 status = -ENOMEM; 1454 goto err_ehash_alloc; 1455 } 1456 for (i = 0; i < sctp_ep_hashsize; i++) { 1457 rwlock_init(&sctp_ep_hashtable[i].lock); 1458 INIT_HLIST_HEAD(&sctp_ep_hashtable[i].chain); 1459 } 1460 1461 /* Allocate and initialize the SCTP port hash table. 1462 * Note that order is initalized to start at the max sized 1463 * table we want to support. If we can't get that many pages 1464 * reduce the order and try again 1465 */ 1466 do { 1467 sctp_port_hashtable = (struct sctp_bind_hashbucket *) 1468 __get_free_pages(GFP_KERNEL | __GFP_NOWARN, order); 1469 } while (!sctp_port_hashtable && --order > 0); 1470 1471 if (!sctp_port_hashtable) { 1472 pr_err("Failed bind hash alloc\n"); 1473 status = -ENOMEM; 1474 goto err_bhash_alloc; 1475 } 1476 1477 /* Now compute the number of entries that will fit in the 1478 * port hash space we allocated 1479 */ 1480 num_entries = (1UL << order) * PAGE_SIZE / 1481 sizeof(struct sctp_bind_hashbucket); 1482 1483 /* And finish by rounding it down to the nearest power of two 1484 * this wastes some memory of course, but its needed because 1485 * the hash function operates based on the assumption that 1486 * that the number of entries is a power of two 1487 */ 1488 sctp_port_hashsize = rounddown_pow_of_two(num_entries); 1489 1490 for (i = 0; i < sctp_port_hashsize; i++) { 1491 spin_lock_init(&sctp_port_hashtable[i].lock); 1492 INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); 1493 } 1494 1495 status = sctp_transport_hashtable_init(); 1496 if (status) 1497 goto err_thash_alloc; 1498 1499 pr_info("Hash tables configured (bind %d/%d)\n", sctp_port_hashsize, 1500 num_entries); 1501 1502 sctp_sysctl_register(); 1503 1504 INIT_LIST_HEAD(&sctp_address_families); 1505 sctp_v4_pf_init(); 1506 sctp_v6_pf_init(); 1507 sctp_sched_ops_init(); 1508 1509 status = register_pernet_subsys(&sctp_defaults_ops); 1510 if (status) 1511 goto err_register_defaults; 1512 1513 status = sctp_v4_protosw_init(); 1514 if (status) 1515 goto err_protosw_init; 1516 1517 status = sctp_v6_protosw_init(); 1518 if (status) 1519 goto err_v6_protosw_init; 1520 1521 status = register_pernet_subsys(&sctp_ctrlsock_ops); 1522 if (status) 1523 goto err_register_ctrlsock; 1524 1525 status = sctp_v4_add_protocol(); 1526 if (status) 1527 goto err_add_protocol; 1528 1529 /* Register SCTP with inet6 layer. */ 1530 status = sctp_v6_add_protocol(); 1531 if (status) 1532 goto err_v6_add_protocol; 1533 1534 if (sctp_offload_init() < 0) 1535 pr_crit("%s: Cannot add SCTP protocol offload\n", __func__); 1536 1537 out: 1538 return status; 1539 err_v6_add_protocol: 1540 sctp_v4_del_protocol(); 1541 err_add_protocol: 1542 unregister_pernet_subsys(&sctp_ctrlsock_ops); 1543 err_register_ctrlsock: 1544 sctp_v6_protosw_exit(); 1545 err_v6_protosw_init: 1546 sctp_v4_protosw_exit(); 1547 err_protosw_init: 1548 unregister_pernet_subsys(&sctp_defaults_ops); 1549 err_register_defaults: 1550 sctp_v4_pf_exit(); 1551 sctp_v6_pf_exit(); 1552 sctp_sysctl_unregister(); 1553 free_pages((unsigned long)sctp_port_hashtable, 1554 get_order(sctp_port_hashsize * 1555 sizeof(struct sctp_bind_hashbucket))); 1556 err_bhash_alloc: 1557 sctp_transport_hashtable_destroy(); 1558 err_thash_alloc: 1559 kfree(sctp_ep_hashtable); 1560 err_ehash_alloc: 1561 percpu_counter_destroy(&sctp_sockets_allocated); 1562 err_percpu_counter_init: 1563 kmem_cache_destroy(sctp_chunk_cachep); 1564 err_chunk_cachep: 1565 kmem_cache_destroy(sctp_bucket_cachep); 1566 goto out; 1567 } 1568 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 30674 bytes --]
next prev parent reply other threads:[~2018-11-09 11:34 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-11-08 8:23 [PATCH v3 0/4] mm: convert totalram_pages, totalhigh_pages and managed pages to atomic Arun KS 2018-11-08 8:23 ` [PATCH v3 1/4] mm: reference totalram_pages and managed_pages once per function Arun KS 2018-11-08 11:44 ` Vlastimil Babka 2018-11-09 11:33 ` kbuild test robot [this message] 2018-11-09 11:33 ` kbuild test robot 2018-11-08 8:23 ` [PATCH v3 2/4] mm: convert zone->managed_pages to atomic variable Arun KS 2018-11-08 8:32 ` Michal Hocko 2018-11-08 8:23 ` [PATCH v3 3/4] mm: convert totalram_pages and totalhigh_pages variables to atomic Arun KS 2018-11-08 8:23 ` [PATCH v3 4/4] mm: Remove managed_page_count spinlock Arun KS 2018-11-08 8:34 ` Michal Hocko 2018-11-08 10:03 ` Arun KS 2018-11-08 10:14 ` Michal Hocko 2018-11-08 10:31 ` Arun KS 2018-11-09 15:42 ` Arun KS
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=201811091945.Ue9XXc0x%fengguang.wu@intel.com \ --to=lkp@intel.com \ --cc=akpm@linux-foundation.org \ --cc=arunks@codeaurora.org \ --cc=getarunks@gmail.com \ --cc=kbuild-all@01.org \ --cc=keescook@chromium.org \ --cc=khlebnikov@yandex-team.ru \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@kernel.org \ --cc=minchan@kernel.org \ --cc=osalvador@suse.de \ --cc=vbabka@suse.cz \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.