Message ID | 20230808020555.658430-1-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1832757vqr; Mon, 7 Aug 2023 19:25:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcSoeqNubEUxRZdc++ZRMIgDIpvTIn0p6SPtdcS4KTdYM62MgJ9Epv5dDsLKDlEbIcd8y6 X-Received: by 2002:a05:6a21:3806:b0:134:73f6:5832 with SMTP id yi6-20020a056a21380600b0013473f65832mr7889931pzb.16.1691461558186; Mon, 07 Aug 2023 19:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691461558; cv=none; d=google.com; s=arc-20160816; b=ZSiILXA1wdEHQLz5t6ab9D2mqFCv9tENCp28o/xEB9PowiDwx7wcj06Y6lXaTsksli 2bHGP4eRehhQt7999dJdVWbXqIAcn2Jqp8KBSJ35k9ls8bM9LSqrHQj5kqDlKv6IUhPT ZHxCLcGZXbNlmQu4GGpSXRi+ECvtMeTGUxCEA6tPeJ2RvZ8SlR3LyUUaNAFVSc5c6PbW Yr1OqO8u+slxPSz59pQeMg9R1oqfADjus7U5fNhB4hxcX5tALQmMXk04T05tduN7NGt3 fa654VSKz19navCa7FYthtfbksn4I+XieUF4BKSE0Zby2u4iu6yyw+P9qDy8yo+d/9S+ NMsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lUs9q3jB+q2zJwM3N1mx9HziyZsU41Y9YEDTJpEbRqc=; fh=Mo/Lcs6WtjcRq1QaiJBjtYwS/87p5PpqCapK5ULE+Ko=; b=O4xQSQwMmMPZRHlXcVBhe4X3BtRMKgwAngmWXlknTNX+xUyfiPbdAS7xyeqf5RPulD OkLv2RLMq1/ycedugSI86wAH9MY3r49PvyIy+I+zIpeU02nlW9VcIAsZFRFOHwFtsCsI olhJrpx6eCe20rpNeYGZE8cztGmWqmFc/sM3PwhnfxoShXD2W9nrSefA/VVDelVkAUpy EP+qMDl4Q7+Aohupe7OrqexNI7sOrZX0Wk0nx3TWy1In1yt+YIM6WSQtF23r7ZF6uHMA rGWuKMfIHNZm8JkZHWitngD85MQc4Ipm9nPMGMgPkn/UxGI1+f7Dy+Eyq2b11bWUQp37 HDQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a056a0008c200b006665f0400a7si3737484pfu.197.2023.08.07.19.25.43; Mon, 07 Aug 2023 19:25:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjHHCGV (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 22:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbjHHCGT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 22:06:19 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943C210FF for <linux-kernel@vger.kernel.org>; Mon, 7 Aug 2023 19:06:18 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RKc2q2fmKz1KCFW; Tue, 8 Aug 2023 10:05:07 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 8 Aug 2023 10:06:16 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org> CC: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH] mm/page_alloc: remove unneeded current_order check Date: Tue, 8 Aug 2023 10:05:55 +0800 Message-ID: <20230808020555.658430-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773625994899959799 X-GMAIL-MSGID: 1773625994899959799 |
Series |
mm/page_alloc: remove unneeded current_order check
|
|
Commit Message
Miaohe Lin
Aug. 8, 2023, 2:05 a.m. UTC
current_order is guaranteed to '>=' min_order while min_order always '>='
order. So current_order must be '>=' order.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/page_alloc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On Tue, 8 Aug 2023 10:05:55 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote: > current_order is guaranteed to '>=' min_order while min_order always '>=' > order. So current_order must be '>=' order. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> > --- > mm/page_alloc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 96b7c1a7d1f2..d37ec87515d0 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, > * allocation falls back into a different pageblock than this > * one, it won't cause permanent fragmentation. > */ > - if (!can_steal && start_migratetype == MIGRATE_MOVABLE > - && current_order > order) > + if (!can_steal && start_migratetype == MIGRATE_MOVABLE) > goto find_smallest; Hi, if my analysis is correct, min_order can be initialized to the value of order before the loop begins. In that case, in the last loop iteration, current_order will be equal to min_order and also to order. The condition 'current_order > order' will evaluate to false, and the 'if' block should not be executed? Hugo.
On 2023/8/8 20:16, Hugo Villeneuve wrote: > On Tue, 8 Aug 2023 10:05:55 +0800 > Miaohe Lin <linmiaohe@huawei.com> wrote: > >> current_order is guaranteed to '>=' min_order while min_order always '>=' >> order. So current_order must be '>=' order. >> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >> --- >> mm/page_alloc.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 96b7c1a7d1f2..d37ec87515d0 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, >> * allocation falls back into a different pageblock than this >> * one, it won't cause permanent fragmentation. >> */ >> - if (!can_steal && start_migratetype == MIGRATE_MOVABLE >> - && current_order > order) >> + if (!can_steal && start_migratetype == MIGRATE_MOVABLE) >> goto find_smallest; > > Hi, > if my analysis is correct, min_order can be initialized to the value of > order before the loop begins. > > In that case, in the last loop iteration, current_order will be > equal to min_order and also to order. The condition 'current_order > > order' will evaluate to false, and the 'if' block should not be > executed? Oh, that's my mistake. Thanks for pointing this out. Will drop this patch. Thanks!
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 96b7c1a7d1f2..d37ec87515d0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype, * allocation falls back into a different pageblock than this * one, it won't cause permanent fragmentation. */ - if (!can_steal && start_migratetype == MIGRATE_MOVABLE - && current_order > order) + if (!can_steal && start_migratetype == MIGRATE_MOVABLE) goto find_smallest; goto do_steal;