From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from sonic302-46.consmr.mail.sg3.yahoo.com (sonic302-46.consmr.mail.sg3.yahoo.com [106.10.242.166]) by gnuweeb.org (Postfix) with ESMTPS id 0C2A980B2F for ; Mon, 29 Aug 2022 04:49:19 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=yahoo.com header.i=@yahoo.com header.a=rsa-sha256 header.s=s2048 header.b=RGRhwl/c; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1661748555; bh=qbpamthQ9OtIIaUieaSTMXVBY+3H1voM2wjsHYJgmiM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=RGRhwl/c30w5JfX3RTDxsjZU1i0BSoM54NMTQpF2Ugb7gO2HPOP2kF/y/v1EvHapG9y/Qu9ydL6alm7KJZevt+pxHFd6q+mGaZ8sBAzNjdKxA6aSJ3PtW+3/vqdrOegofqNIc9wOkGoaIXBRVvFlTioddKxT5CVpMGwrwjadW/sVVgI9nL58gZs2EYqfybEGLEveMrw7oNcxmYqzdEoVHogaYzWGSuZ61ldwHboTHrBQtKqybpvisiGvC1OHsln5fuRBQMUKtgYMKgZNPk70AtXmG7DAXcJT0NBDEkLq5mQRg5uIF3o+kb47Qe+5L7uPv9nMb/9Di/57G9T7Q5Qq3g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1661748555; bh=Kuhp+jH+CXzeGkkhs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u4YdbIWGcFSQk_EvzZZLWB3Pgbpr6H0 28Dc3ZCMB1GCot9bubUOQvYocjzE6BJyUYHaDT4QVWz2hDQrjfwC.FsYsScyGHX_CmVWcKBfVCMQ STPwbUSNwK4Z.OlnytBy4OUgL4Ru1Wh16duEXTe2Xz9poQgJw1__beWYazwczCTT.fYYPLgTHx9q ZhgkncF3FIJ_mOFyoDmhoGsROsobIVGI_yhbH.6dMgsx_XYqRd9D4QqAGZYuP.BlMc9t1by5nv6V VHHb5cN_7t4MbF9JkmOrZ.QlzqQfIdwyyfn4iqazf7EfmH0kuHylfSz_WdUqJrlNsP6kQmwmREZv 0lOKYYPJ3cW8vcyoufMJCxegfU3DTPxSpXnoP4n9k_xfl4zgP4nIu8oBmgmxRq.im_TvjWJp_38i geiU8InUpjzAszl5RKuX57K3SOY8uWQjKvsbwjY0J6j0w6Y2xA16btPdER5jOJHmCVZY_EDzJmos rj0O0ZLH1DeMSvsqQ2rouqBPB.QlXpEQbJkkt0YDPVjRytBuF7_f7RvVwTu5nEq6h7cM_8tYx0oj DM_p64dHcZsh4fsi2bF.JkDDILE7.AVB7Gr3rhkAEO3dmxalGRkza0ZqcEfwVvukxW_iCYuB1BzB tM0pSCYQNcBpe X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.sg3.yahoo.com with HTTP; Mon, 29 Aug 2022 04:49:15 +0000 Received: by hermes--canary-production-sg3-6f58cd9b5-fkkv4 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 4cca373a02cf1b923da71b65b1d3404e; Mon, 29 Aug 2022 04:47:14 +0000 (UTC) Message-ID: <434d363a-b76a-d700-97b4-39107d085c85@yahoo.com> Date: Mon, 29 Aug 2022 11:47:12 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH v1 1/2] chnet: Prepare global struct ch_thpool array Content-Language: en-US To: Alviro Iskandar Setiawan Cc: Ammar Faizi , Muhammad Rizki , Kanna Scarlet , GNU/Weeb Mailing List References: <20220829011127.3150320-1-ammarfaizi2@gnuweeb.org> <20220829011127.3150320-2-ammarfaizi2@gnuweeb.org> From: Ammar Nofan Faizi In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20595 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo List-Id: On 8/29/22 11:21 AM, Alviro Iskandar Setiawan wrote: > On Mon, Aug 29, 2022 at 8:11 AM Ammar Faizi wrote: >> + g_max_ch_thpool = std::thread::hardware_concurrency() - 1; >> + if (g_max_ch_thpool < 1) >> + g_max_ch_thpool = 1; > > this is wrong, std::thread::hardware_concurrency() should be treated > as a hint, if this happens to return 0, then the sub with 1 will make > it ~0, that will definitely hit ENOMEM. > > this should be: > > g_max_ch_thpool = std::thread::hardware_concurrency(); > if (g_max_ch_thpool <= 1) > g_max_ch_thpool = 1; > else > g_max_ch_thpool -= 1; Ah yes, you're right. Will fix it in the v2. -- Ammar Faizi