From patchwork Wed Aug 9 10:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13347321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9CBC04A94 for ; Wed, 9 Aug 2023 02:07:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4EB726B0071; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49A536B0074; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 362318D0001; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 22AE26B0071 for ; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DB2EA8057B for ; Wed, 9 Aug 2023 02:07:53 +0000 (UTC) X-FDA: 81102930426.19.99B6B7E Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf17.hostedemail.com (Postfix) with ESMTP id 5FC694000F for ; Wed, 9 Aug 2023 02:07:49 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=none (imf17.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691546871; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xBSZPX5FYhYWj4xHTDCMD4smmcokZS9fX+L78mPfbw=; b=ivwHNF5NiZyXYcj8vY8mZXVGAUrNc6078S0ZR9bPTZgyIyRF+Efcmw8ZgP/UP2u0NEZPKK TzbJ289GxJmfkyJofvqldPesNFEVjhNcpNWu5Q7IRLuWDKIB8Yo207drZZphIVemdGDX8n T7Spry482IdQQ7j1469WVnifgj7FGSU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=none; spf=none (imf17.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691546871; a=rsa-sha256; cv=none; b=j3OiouPwNc9FV/7sT33Dmnf/F0b3q1lDQxuOrlCSCLKxCtmdoGe3LeHlaOKAQ5a6aLzE3P 9XJRs0Xa4/MTQ9kSZFSbIb4idqk3z8aFKkvQcsgp7TVVd98/v0uY6TfY8CiXERkoQrcqI7 POErRtkrM73e1fo6BOuCpQ8htmYVM3g= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RLD3N50KRz4f3p17 for ; Wed, 9 Aug 2023 10:07:44 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgBXem7v9NJkFAkTAQ--.60414S3; Wed, 09 Aug 2023 10:07:45 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com, willy@infradead.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 1/2] mm/page_alloc: remove track of active PCP lists range in bulk free Date: Wed, 9 Aug 2023 18:07:53 +0800 Message-Id: <20230809100754.3094517-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230809100754.3094517-1-shikemeng@huaweicloud.com> References: <20230809100754.3094517-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: Syh0CgBXem7v9NJkFAkTAQ--.60414S3 X-Coremail-Antispam: 1UD129KBjvJXoW7KFyrKFWkGw4kKFyrKr18AFb_yoW8GFy7pF Wftw1SyrWkJryrCr4DAa1Dury7Kw1qkFWDurWrG348ZwnxWFyIk3WIqr9ayFyrJFWkZFy7 AF4UJryFya4UZ3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBK14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_Jr4l82xGYIkIc2x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2 F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjx v20xvEc7CjxVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYx C7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRE2NtUUUUUU= = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 5FC694000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: iwpruftacezy4u4dczbhsj4fkkkj8oo3 X-HE-Tag: 1691546869-800321 X-HE-Meta: U2FsdGVkX19oYd6hGZwyqFn9RcakUg++7OYiZNVJqel+B5n8aJiWhXZxOKiiD/i1+MgT6depmwDXNHV+dXOBwHPufOZ45gz/IabsWudWNVxQansXC6bA3WI4Jb9aGYdGfVzhclAwFxJUjQPfjIwuyfgaULCTDGfGIOZv76BAiWXTDckWyunluS9chFpkwVI2vnAz0Xur4BobNxjf3qczeZ02Ru3Qutqk95/CDhWcwijnpCsagV2x8CW1811D5rNZ8+zlha0+Iv/DzMN/R6ZOli5yobBqufsySnmOrCQ9pm/SYFPIUbYTeorQCn0RqjO6ogXC9IhVbTmymZ3ysCAlo0e6J79d7poJwhiUGtlEQGt9Bk082LJo2RYo0qNFUslG9+W3CHB9EdImOCFLVkF7dH4BUMgPzSeYojhMnqFDiOjw3UUEBRr0gqfE9bAANSBZpUcoD+TSSi/mWBUob5fo59uZLVSuvlMO5UelmERPbLOabHwwOOz+x6prFAk77ZEiJWa2VVXXxXL+KwrfN3tFneT5pHyX1RqBFKbWKItqMBv9KlNqR+UD+ordQrZCxvBLK7CEkyrbC4mIFn0vg8RLgmcmEz4eWsAEoMxgxLL6azaLjgFplVcqmNIfdv9GkN4XDBRqtyZwt32123x2vAqjlaK+kPcnZ7NZEqdPsT7WSmAu72XhEZ2Rp0KKh3uqweO0a+j4X6hXgWXvZHKEjINqngqNkQmZ8UbCHI83xk8oR4FyWJkveDl1q1CBEp0pQcyXFlRNS0YM8BlsK99dLifvb1aHhtshm0utKpwD9qtmwgFBSrUvbusaT9A36HE29F+l0M+9Q0oZaY+XFbY04Va3dIT9xC7X8Wbq1Nq7a/hQWgf8X8FKrIODa+iVlIzIE2K/cEZxNiWBBr+6/vFY6FIQQDSz1d5b6sOeYHFbt9yiT5v0JtYdWb7NTFNH2bQNS7Ykl5126SuzPSooi4VA0ox FrQCTGfy P0Dq5YCafwSn69pGPgzvr8gZ7FC7iZsTVNEHhKqiloLJmGsis7VIf99UsifleNY24MS6GslG+rd3IwWhyGFq1u0oxqt1CzssP0ZPDxNEIhxWGFlXlYRYOHS9dBLSB32ncML9R2rt9UlGDC4cXYDbpax9KAIE4LiZucQtmdUIMigM6V0zHL+Wm3RcLjBOmduhjDZzJkOJ4vNCVfJjIG1XKENBRiMR/Upw3YURNFpo4q0bLvGAAKd/9SOMFX1Cj00FYWBI8QllACkHskVcfV02ku6L8hg+MXkZDf3XaLTM3uDTI4i7PWiW/ICvRI5hVKfrKXSlK X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: After commit fd56eef258a17 ("mm/page_alloc: simplify how many pages are selected per pcp list during bulk free"), we will drain all pages in selected pcp list. And we ensured passed count is < pcp->count. Then, the search will finish before wrap-around and track of active PCP lists range intended for wrap-around case is no longer needed. Signed-off-by: Kemeng Shi --- mm/page_alloc.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 96b7c1a7d1f2..1ddcb2707d05 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1207,8 +1207,6 @@ static void free_pcppages_bulk(struct zone *zone, int count, int pindex) { unsigned long flags; - int min_pindex = 0; - int max_pindex = NR_PCP_LISTS - 1; unsigned int order; bool isolated_pageblocks; struct page *page; @@ -1231,17 +1229,10 @@ static void free_pcppages_bulk(struct zone *zone, int count, /* Remove pages from lists in a round-robin fashion. */ do { - if (++pindex > max_pindex) - pindex = min_pindex; + if (++pindex > NR_PCP_LISTS - 1) + pindex = 0; list = &pcp->lists[pindex]; - if (!list_empty(list)) - break; - - if (pindex == max_pindex) - max_pindex--; - if (pindex == min_pindex) - min_pindex++; - } while (1); + } while (list_empty(list)); order = pindex_to_order(pindex); nr_pages = 1 << order; From patchwork Wed Aug 9 10:07:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13347322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFFA9C001DE for ; Wed, 9 Aug 2023 02:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74E696B0074; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DB8A6B007B; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D76A6B0075; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2368D6B0074 for ; Tue, 8 Aug 2023 22:07:54 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D9591C0E0C for ; Wed, 9 Aug 2023 02:07:53 +0000 (UTC) X-FDA: 81102930426.20.2DEBA81 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf20.hostedemail.com (Postfix) with ESMTP id 6FC301C0014 for ; Wed, 9 Aug 2023 02:07:51 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=none (imf20.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691546871; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VJ34kD3FHV8oFdywL+Y0vzWD/8e4pWr1LeA0o59femk=; b=zaKE8n1rhgjtur+a0EPdIF7hPdwgqRYSqQqELzPvX9WqHue3sUMWIeHRkDP1qeOaGgNg+7 nqKrdJ/ptz6QdttsglwxRLh7ZskwPZoGTOaukfByB61IdSCs8+a9P0zh8wNOAT2Q7BikYT AIJSTJ1eEYmRgK0cEQyPJBuLpIaFiXY= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=none (imf20.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691546871; a=rsa-sha256; cv=none; b=SjvEahGr2CbmltV8BsRm887tIR1ud5S1Pnj6Ryc3hOvaBVt8AvBLbJqbOKQIduU5YZXeHB mxOARmwM2fFUKydT1MldFlr9EB5VWkD9OPZPuOj3o0rs6Bm5RKyW7BXF7erUmsn6gbVjFP VQBYu3dblMZpb4FBOnOTLsDokWx0dsw= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RLD3P5TSWz4f3prt for ; Wed, 9 Aug 2023 10:07:45 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgBXem7v9NJkFAkTAQ--.60414S4; Wed, 09 Aug 2023 10:07:46 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com, willy@infradead.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 2/2] mm/page_alloc: remove unnecessary parameter batch of nr_pcp_free Date: Wed, 9 Aug 2023 18:07:54 +0800 Message-Id: <20230809100754.3094517-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230809100754.3094517-1-shikemeng@huaweicloud.com> References: <20230809100754.3094517-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: Syh0CgBXem7v9NJkFAkTAQ--.60414S4 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFyDGF47KFykZrW8Jw13Jwb_yoW8JFW8pF 93Kwn7KFWkWwn8G39rJF4qk34jka1rKFZ3K3yfW345XF13CryIkFyIyryDWF18KrykCFs7 CrZ5t34rZa1UXaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPab4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJr0_GcWl84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2 z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4 xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v2 6r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6I AqYI8I648v4I1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAq x4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r 43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF 7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxV WUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjTR QNVDUUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: xadghkw6bkunc6nrn7pbysn686fbzw16 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6FC301C0014 X-HE-Tag: 1691546871-116596 X-HE-Meta: U2FsdGVkX18n/H8nhp1oCtePvyMODkMyaJMngijf4fHPuNSncym4PeVqxnoPoUQEcRaRGcxPkeLjkm1VesbiTaLxY1bX95K518S00qJ6hRm+bJz2QctaJjxF9Cf+8CjutTxiOOT8SZenGeqG9ZxftySKpLsBut8HElDdj+rHwuTIo7vjKnAWrW0fQ/xTKGwDLbnT/SlT2cqYHgEDn6oUD/Ws5z9I5twc1T5vj+JMt1tTJly1FS165QNjQG9Fb/GVFsw7D2tZDtx4TCcfnY4gd5Ind38mgONvMdsW+hAOIRruZUa6aU9hHqRIDQZpq57ODHVBLwCEUEq0pt5V4zfsLrNJPkMFK+gPnADUMPh9lZ2xSPWAs7G3SygZLiL/QKV74xF/urbpxOSLbuD0f5zo+O7ChBNvyaJdyGuXD+oNbgwkB83N48cfG/1eiVm3ArKphvXH7S3LxRM8DrOmmYGBhqsXRXQ0e5N+Zc0l8OmoHeNhGWkEFFPx0gdxpFrS/+adD0ZvWqL1jNki6JcG7BV4GC2LQjmZyDzu1/JdVJf2CywqpfDrswuGqUYpE9yjTbWZND4paw+DE15Oa2YSIr78NSGLcbNFlJPFlMfzxGvwpPx9VU0pbweh8xESm2E8+LoMz6aFLjMFdFswLJpFlU+fGbNkzJ0CDDh+pKQ3wXdEr4IluLTAjHvG8gzGIAIilRQ2NQ0czjc/YubY5V/G2gEpPFtzHXpMJOH0CH4y2lzDB7pNswzsKfRnK8oOX6uv0NAAIQfOfFu6fsj8ARuGK2H/aWjgqyWtfnghTAbaDIjzlPm3u8CXjZjoGeEw/0crq6HFaLko/nzrgskkN6Xjm+rqnNtv2hiPolMLMb7owN/VBfPXGdpjcGfa46bFziqFvR3+F8ur7ejAyzPWoM3E5u35qqihAXBlXZT1p5f3O1ljFcGQMGmMKKgHU0Sof2LKARGbSj47w4XO48KA4s42+bG jVyORicr ChwZnZB/ZkY7v0xegp9O15Yh9+Q2rcPEMc29SDVYiQUMMpFFh0LSamknP0IfnL2Ek6jg3+yfDrIkJygr0GktnN72dj3um4FqcZUZkC0XO29oMdKdP+sIGJlPQ2iuzUieZDe/cCHqo/F3OoXEY4lSiDmaMMaKHdD8a1F7/9x7ZCsqjXmE0Ea2tJeIV09wOK+g0REJktmF9c4cSIsJ4yeWAUjh0C9PmiaENnyEjqghtDNw3wZbv3M/XsCU8+M/kyVbtjvsJrYA+l1twkDDhJ66vYnmqaGmxb/bCaUYI0TIFr7m1bt48l6EsrUsICreV7+Q7kt9R X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We get batch from pcp and just pass it to nr_pcp_free immediately. Get batch from pcp inside nr_pcp_free to remove unnecessary parameter batch. Signed-off-by: Kemeng Shi --- mm/page_alloc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1ddcb2707d05..bb1d14e806ad 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2376,10 +2376,10 @@ static bool free_unref_page_prepare(struct page *page, unsigned long pfn, return true; } -static int nr_pcp_free(struct per_cpu_pages *pcp, int high, int batch, - bool free_high) +static int nr_pcp_free(struct per_cpu_pages *pcp, int high, bool free_high) { int min_nr_free, max_nr_free; + int batch = READ_ONCE(pcp->batch); /* Free everything if batch freeing high-order pages. */ if (unlikely(free_high)) @@ -2446,9 +2446,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp, high = nr_pcp_high(pcp, zone, free_high); if (pcp->count >= high) { - int batch = READ_ONCE(pcp->batch); - - free_pcppages_bulk(zone, nr_pcp_free(pcp, high, batch, free_high), pcp, pindex); + free_pcppages_bulk(zone, nr_pcp_free(pcp, high, free_high), pcp, pindex); } }