Message ID | 740a2396d9b98154dba76e326cba5e798b640ead.1673342761.git.baolin.wang@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2752004wrt; Tue, 10 Jan 2023 05:40:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXul9LGhJkfNrd+BkbZwO/N1aeZ5X8U4Hlu+ns/l/4uqR2apVzNcRmEwudX9YvJNhcTT6RtV X-Received: by 2002:a17:906:d052:b0:7c1:5098:907a with SMTP id bo18-20020a170906d05200b007c15098907amr61197144ejb.35.1673358056661; Tue, 10 Jan 2023 05:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673358056; cv=none; d=google.com; s=arc-20160816; b=zYRvXuk7CTGhMdK1kUIMlwlYmZUANBXVSBUgLJb5HLtoov7MaoqR1lcmpGWxRZ8CPO 8EM3Mgn2cx/TWrmZDw2oGe1AmrWwPNNhP2mS4nyszurkFC7ieBED8hGM2yIbgcyxYlK5 7ah6pKhl1bhovl2+zg/xRePPVt0RT4Qjo8byYDg6ZfejhLeTP/evZMGiZHXY2ueMjLLT zL1n4RU2qli1wMWHwACCG9jy4T7KwsZcMcYrAXaSQlhg4Js60f8m50OT2/AKYWKHuGZb WKLE2FK3aqTZJQWZvc3JiQVC18NU3fa7XDIgeifEfvltymRvZytiEwCQoRPFQWn7avnJ m9GA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=79EipwoUGWr7Dt7aei0D+jzzxgqlEkuV8Uc+tPdrsQM=; b=TzJAbAVVUUcw2ereh9ZivBXDZla4jGOl19+Gh0ZLxXullqUe5NL88svLD3qaE1ksFq WtmGip08OJNU+2jZuB6zBjAI6tlT/bcsL3twtr+ATPc+0f/t7mzrpdghNwgmozWyteqQ JEYwkWQenNPU+nWNzZD4oWLA4tAtW92tBJyFaBsMO13MzP7xttk0bRXOCSN9IuSgvw/u XntK90ZFZdALci1SPVSPRzjvRQdR5g2om+kUwaHJm5Q+hAoi/aM3c8/Z3xiP+4Xu2xrd i5pBuF6t0GL4TwvDWIi/i0fDl1yVo4bF6mlMqiKfg1gcLhYEL4gggtu3QKNgiFX3TS1B iWgA== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xe9-20020a170907318900b007c31c5206c5si11334107ejb.436.2023.01.10.05.40.33; Tue, 10 Jan 2023 05:40:56 -0800 (PST) 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238608AbjAJNgs (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Tue, 10 Jan 2023 08:36:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjAJNgf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Jan 2023 08:36:35 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CFD8BA3 for <linux-kernel@vger.kernel.org>; Tue, 10 Jan 2023 05:36:32 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJNeww_1673357787; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJNeww_1673357787) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:27 +0800 From: Baolin Wang <baolin.wang@linux.alibaba.com> To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] mm: compaction: Remove redundant VM_BUG_ON() in compact_zone() Date: Tue, 10 Jan 2023 21:36:18 +0800 Message-Id: <740a2396d9b98154dba76e326cba5e798b640ead.1673342761.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <cover.1673342761.git.baolin.wang@linux.alibaba.com> References: <cover.1673342761.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754643097551687004?= X-GMAIL-MSGID: =?utf-8?q?1754643097551687004?= |
Series |
Some small improvements for compaction
|
|
Commit Message
Baolin Wang
Jan. 10, 2023, 1:36 p.m. UTC
The compaction_suitable() will never return values other than COMPACT_SUCCESS,
COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS
and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove
the redundant VM_BUG_ON() validation for the return values of compaction_suitable().
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/compaction.c | 3 ---
1 file changed, 3 deletions(-)
Comments
On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote: > The compaction_suitable() will never return values other than COMPACT_SUCCESS, > COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS > and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove > the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). I don't understand why we'd remove this check. > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> > --- > mm/compaction.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 62a61de44658..5e6f5e35748d 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -2313,9 +2313,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) > if (ret == COMPACT_SUCCESS || ret == COMPACT_SKIPPED) > return ret; > > - /* huh, compaction_suitable is returning something unexpected */ > - VM_BUG_ON(ret != COMPACT_CONTINUE); > - > /* > * Clear pageblock skip if there were failures recently and compaction > * is about to be retried after being deferred. > -- > 2.27.0 > >
On Tue, 10 Jan 2023 13:37:57 +0000 Matthew Wilcox <willy@infradead.org> wrote: > On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote: > > The compaction_suitable() will never return values other than COMPACT_SUCCESS, > > COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS > > and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove > > the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). > > I don't understand why we'd remove this check. Well, just from code inspection it serves no purpose. Such an assertion might be useful during early code development, but I think we can consider compaction_suitable() to adequately debugged by now?
On Tue, Jan 10, 2023 at 03:25:32PM -0800, Andrew Morton wrote: > On Tue, 10 Jan 2023 13:37:57 +0000 Matthew Wilcox <willy@infradead.org> wrote: > > > On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote: > > > The compaction_suitable() will never return values other than COMPACT_SUCCESS, > > > COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS > > > and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove > > > the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). > > > > I don't understand why we'd remove this check. > > Well, just from code inspection it serves no purpose. > > Such an assertion might be useful during early code development, but I > think we can consider compaction_suitable() to adequately debugged by > now? What if compaction_suitable() is modified to return another value? This seems like a relatively innocuous check.
On 1/11/2023 7:37 AM, Matthew Wilcox wrote: > On Tue, Jan 10, 2023 at 03:25:32PM -0800, Andrew Morton wrote: >> On Tue, 10 Jan 2023 13:37:57 +0000 Matthew Wilcox <willy@infradead.org> wrote: >> >>> On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote: >>>> The compaction_suitable() will never return values other than COMPACT_SUCCESS, >>>> COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS >>>> and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove >>>> the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). >>> >>> I don't understand why we'd remove this check. >> >> Well, just from code inspection it serves no purpose. >> >> Such an assertion might be useful during early code development, but I >> think we can consider compaction_suitable() to adequately debugged by >> now? > > What if compaction_suitable() is modified to return another value? Then this will be an expected value which should be handled by caller, and IMO we can not make such assumption for future to keep this unhelpful check.
On Wed, 11 Jan 2023 14:40:20 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote: > > > On 1/11/2023 7:37 AM, Matthew Wilcox wrote: > > On Tue, Jan 10, 2023 at 03:25:32PM -0800, Andrew Morton wrote: > >> On Tue, 10 Jan 2023 13:37:57 +0000 Matthew Wilcox <willy@infradead.org> wrote: > >> > >>> On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote: > >>>> The compaction_suitable() will never return values other than COMPACT_SUCCESS, > >>>> COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS > >>>> and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove > >>>> the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). > >>> > >>> I don't understand why we'd remove this check. > >> > >> Well, just from code inspection it serves no purpose. > >> > >> Such an assertion might be useful during early code development, but I > >> think we can consider compaction_suitable() to adequately debugged by > >> now? > > > > What if compaction_suitable() is modified to return another value? > > Then this will be an expected value which should be handled by caller, > and IMO we can not make such assumption for future to keep this > unhelpful check. One way of looking at this: if the assertion wasn't there and someone sent a patch which added it, would we merge the patch? "[patch] add check for compaction_suitable() return value" "why" "it might be wrong" "it isn't" "but we might make it wrong later" "the same can be said of every function in the kernel" And if we wouldn't merge a hypothetical patch which adds some code, we shouldn't retain that code, no?
diff --git a/mm/compaction.c b/mm/compaction.c index 62a61de44658..5e6f5e35748d 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2313,9 +2313,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) if (ret == COMPACT_SUCCESS || ret == COMPACT_SKIPPED) return ret; - /* huh, compaction_suitable is returning something unexpected */ - VM_BUG_ON(ret != COMPACT_CONTINUE); - /* * Clear pageblock skip if there were failures recently and compaction * is about to be retried after being deferred.