From patchwork Thu Aug 10 09:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13348675 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 C7B74C04A6A for ; Thu, 10 Aug 2023 01:53:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 806006B0071; Wed, 9 Aug 2023 21:53:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F7436B007B; Wed, 9 Aug 2023 21:53:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D2BB6B0075; Wed, 9 Aug 2023 21:53:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 30AEE6B0074 for ; Wed, 9 Aug 2023 21:53:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EAFAFB29CD for ; Thu, 10 Aug 2023 01:53:09 +0000 (UTC) X-FDA: 81106522098.07.E18BFF5 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf18.hostedemail.com (Postfix) with ESMTP id 423C91C001A for ; Thu, 10 Aug 2023 01:53:06 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=none; spf=none (imf18.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=1691632388; a=rsa-sha256; cv=none; b=iMGMgKI0GD8gXiDg+PQtRhNaG+UJz6zw15BahYec8BxIfDOI3O+gWfCl+oMxagB/17bFQL 7Jd0kH0Nu0Lj/IA2Po7uDKUrJwJg8tyz9aMvGAfBCFQVHqi3we1wBo+BKaWCMykbIHG3dl rUq0K713x8hqQYU5WZSFXOdlTdojK7U= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=none; spf=none (imf18.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=1691632388; 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=nIqZB04IiPyJXZi5xQsaTzy6cjJNH//CpUiITuOoPWM=; b=JKnVI1nB2/L94ErpDTWFtozN1JieMVtUkGxzSEcRTozPQ3stC5CaGhvolC6yRFUvFOG5pX xnHpMYFz837g4UQPkdrfk6lam9iP6x4YlsWrUTvHu1M18xKFoO9axFfDO6kLx+w2XeooAX zBm+bl2i0t5bWtH2DYieHi+NKYwM/w4= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RLqgx1kLCz4f3mHJ for ; Thu, 10 Aug 2023 09:53:01 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgCXJ6r8QtRkiaZjAQ--.27199S3; Thu, 10 Aug 2023 09:53:02 +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/3] mm/page_alloc: correct start page when guard page debug is enabled Date: Thu, 10 Aug 2023 17:53:07 +0800 Message-Id: <20230810095309.3109107-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230810095309.3109107-1-shikemeng@huaweicloud.com> References: <20230810095309.3109107-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgCXJ6r8QtRkiaZjAQ--.27199S3 X-Coremail-Antispam: 1UD129KBjvdXoW7Xw15Ary8Zr4DKr1UZryrWFg_yoWDuFb_uF s7trs7tryUKa4IkF17u3WxJFZFqwn5ur4xXF1YgF13Ka4DAFn2ya1kX3WfArWDZw1xuryU u3ZrXrW5XF17ZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb6AFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28C jxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI 8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_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-Server: rspam08 X-Rspamd-Queue-Id: 423C91C001A X-Stat-Signature: wsaaicxfuhn4keyytcz4yxo6strhkiz1 X-Rspam-User: X-HE-Tag: 1691632386-568997 X-HE-Meta: U2FsdGVkX1+997Smmxp8+a7hn7qzBpNu5RqPMKzMUb1CbrYQBLmzOXw8gpiscFfmfZqgi4voy+ZyecjPJ7htfgZfujT+JbDktFNA060ftiTuFdtclaPBHq45m1/0xKP7AukCL5KStjRpsM35m+Fc/h3Fm0E3DxTrKkw/9XYCm+SXHhRBA6APrK5H+2w4ru3mKWIv3Iobmi+pBnzrubgWm4QNS96+yLh/GpnsVNXxbI2PJciX4Vxh6nbNcBTCBZzRJ75vq+HhB6/NW3EOES2ZDJpp/+ejx5xCzLI6DEhvywy4Lo05q3+b/kbJnWTNX9d9fpUKe3h7SRMJnirPocOKlyC5ms45V6odGq/mohQfcrU08cFi5r5qvBxXlz/TWlwI67a6yUwABYzMTgXLy574cXDorraEpPuxqAg/kl2w7r01liy3lV6WMoljW/4h4hFTZfHUALKV+vTCa8uU1/F+fluVFOWKUI6iKhXNj/9g9T6UYWE4kxT0MLHF//xQ8z0S7pI59XZ/V19mR49j5cqlrh7ewkvpXN3JOMe54EaBVmMYrYdY72Nb/kbEPYxAJjubizKgwK5Le++FRC9O8ydSJFDu/4opJIeNpcE5LozyhJdiIGM95nt7O472WjzulqoYBDqeYZEevOutPebNOT+Y83A1Dz79J+fVk7RdOUQ2rc+YLrKwpVoGuMbMC+V9SEpVGLHAJWfWRoJnc+SUMifZhMPMUmxn/ypH9GGMlZpwyngDLsWOu3FrpTvcZhVTA1IrlzjZVZtXP2iNVMDGInD8yc1z7iCUrAR3Jq0hgnqxj8Ae+YoOxhS+e7DjCzy55Rw0NzflQl3o6eSWhPovwz7x8ww1dxXSgU9ialKgYSuqHQWi8oysbZCzOKfPWQ8slo5eJL94Hz9zi9iHyF5YsuulV8mO2cD+3ElTemxXr6dg/XCsFn0KN3XKZOiHJ4fymXjP9eKDPayWjazjPNx66VF FFgF3pSZ JOQdAeH1UtNgDpQK2QhZ6636u84cdKhBE1TyJWYNoJTYR029hlxxy7yRjZ6hlpeobMizYUviP8+iB3lLNIp7GEQ+l3FVar920y6ar7WJtWKyxy3qgREsZ2Ry88T+1lt0SV/knhyLFYvBGyKFqWD3kGp1Mhmj9BYB1YYwmS2sVV5Xiz0YhnLMrZSKIFmEdLDgbCXDoqjF9xcvnPEGz25Nl3dUGKh5wBsKLl8gECO7A3dno67HqmfzUQrHLD66gIv4QrwDqwZfk9pwLJ8Q= 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: When guard page debug is enabled and set_page_guard returns success, we miss to forward page to point to start of next split range and we will do split unexpectedly in page range without target page. Move start page update before set_page_guard to fix this. Signed-off-by: Kemeng Shi --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 96b7c1a7d1f2..fd93d1396ccd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6557,6 +6557,7 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page, next_page = page; current_buddy = page + size; } + page = next_page; if (set_page_guard(zone, current_buddy, high, migratetype)) continue; @@ -6564,7 +6565,6 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page, if (current_buddy != target) { add_to_free_list(current_buddy, zone, high, migratetype); set_buddy_order(current_buddy, high); - page = next_page; } } }