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;