Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp36250rwn; Wed, 7 Sep 2022 19:27:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KLsIrTSsbu88iM9qEDa5Me6zwzwJkMpvr43E1VESCHg7GBr4l5SFgiYNdw9Ka7dKWzUlC X-Received: by 2002:a17:906:db03:b0:741:337e:3600 with SMTP id xj3-20020a170906db0300b00741337e3600mr4509625ejb.343.1662604050155; Wed, 07 Sep 2022 19:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662604050; cv=none; d=google.com; s=arc-20160816; b=tBV8fg1MGi2GpIzIAdXtIOy20NAWh/Ej8p2gvdzraYkQaoFkfJaxd5HHUMeuGaJhfh 0QhCnrOrgBZCn9g95ENeR6YXvsc2I3reYOgWF38rmFVAwmrCmLK9wZb/W7AqfIkJofl5 B2YTA9s2Qr3FtOvhtuAuGBzJY3DaFbtb4eDoRdSP/mZY80uQOUq6FP033nQNIX0eE1f0 /dPmVtreMXDMS9XRXyXQcmHeUFesm5ay7CwePvg5eUpPw89a9ZkkgHXzXUB5xOZBUXQ3 6q7u7zCHKnkodOfl0c37Qqb43mkkCmZRakW1RDW1FenQRsGxhcYlcNITKqwPgo0NScNs IyXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BLF2kMmdrofDBi9O5TGkANVsUhpE8WNQauup993bzoc=; b=NooYAsxZXbW707uVnT9Hc2F6b9o05uz7ggRY6LPtnZ10WtCS1uxhi/guyxzdag1de9 vYFxquKhNPOZo8aT6TBHX77svbC1Ky09DZgNM/rDpcDavxT4zzy5+2pM2LaYfuaDG1S2 /khpgvPGHV52bakr0txqGBZYfAAwEhLYRdoaovCv+FBd7vtRE5iVDHFX3/uoGLavGUBY +WrVDnRV+emIrLQOA67+iHVqiQRazNtn1KUiL7/7o9GthxMsh6k561+ZvzGrv/Ajx3II MuiL20n2JifIGNAw1qjoBuGJKtKwJX/myozf9nWIeL/zu+B8k8fB9LneMcPy8ZfQnZJR s2bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nczWRa35; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a05640240c300b0043de3215579si14868280edb.12.2022.09.07.19.27.05; Wed, 07 Sep 2022 19:27:30 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nczWRa35; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbiIHCHz (ORCPT + 99 others); Wed, 7 Sep 2022 22:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbiIHCHx (ORCPT ); Wed, 7 Sep 2022 22:07:53 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD12DCCD6D for ; Wed, 7 Sep 2022 19:07:52 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id m17-20020a7bce11000000b003a5bedec07bso628173wmc.0 for ; Wed, 07 Sep 2022 19:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=BLF2kMmdrofDBi9O5TGkANVsUhpE8WNQauup993bzoc=; b=nczWRa35lOHHeQ8shY0JxNDzyMHqVdRYOe8HN2jvgFdoqs55hP2m9qZLvzNbVdkdAu dU0i8dvLoTSTRyHu2GnF4Y06hg47lwqbypR8Nf4LgAR4TtH/pJtLY9GNlPV6I2uqeET4 ygyhzJ0MlBKvz6/kVtTiobHimOu3uYJ+OjmZEz/PfJZ9hpEwqDkQoWUsSigehgsUkyDB bnjkVoesWlE94tFprdCXTOFVtWKkdKEYQQiGbP6zMhVnJsjyMwKsUj/NnrqguNxOhMWi stGwck/Zi2MSrkmiQCEsOaakLZyXT0PVfo91GbmyC1iOuKxboKK6mOHxGT4TW0MIAH/j bp+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=BLF2kMmdrofDBi9O5TGkANVsUhpE8WNQauup993bzoc=; b=iXKUyoa0IB0Gu6QRzRZyoV9Yayw3eapu2171DAUbkdrVvUrSPzYGSMF7+DzjUkvUyg 8eHmGsclBzUI0HYdPFqETRNx+PnmL4H8Vippj/ynhoaFzz/1CxQeR/mTKmyAJWx7aIew 8tnbH6pak4+qBQTGYOonbq0DazIJe55Vm4bfBXMFMDFnXGOoMZUNX9+67jRXYxUsA8PC zKqhvR4PKpr0OQ+UN+lAx+knDWDKcPvxI+j5LTDPhkGRjlpwXOAM4k6kGdhLIxg/Vgel Iooh8bGvCQynOApcmBo3bRowzCTnN18GxUypvrMt9p6iOEt/HnRj2D0tqUyQMrDlq4Tu LdAg== X-Gm-Message-State: ACgBeo3b9KTJ8djGCpJwXMnNZvKRVXWOkxfDJHPJaOwc7EC6oDVCrXjC RCoUcXrbUtVAwV6UaA7FriZ/g7eALqye6T3m3JxJgTULAQ== X-Received: by 2002:a05:600c:1554:b0:3a6:23d7:1669 with SMTP id f20-20020a05600c155400b003a623d71669mr657805wmg.70.1662602871310; Wed, 07 Sep 2022 19:07:51 -0700 (PDT) MIME-Version: 1.0 References: <1662568262-20925-1-git-send-email-kaixuxia@tencent.com> <20220907174207.61191-1-sj@kernel.org> In-Reply-To: <20220907174207.61191-1-sj@kernel.org> From: Kaixu Xia Date: Thu, 8 Sep 2022 10:07:39 +0800 Message-ID: Subject: Re: [PATCH] mm/damon/vaddr: remove unnecessary switch case DAMOS_STAT To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, LKML , Kaixu Xia Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi SJ, On Thu, Sep 8, 2022 at 1:42 AM SeongJae Park wrote: > > Hi Kaixu, > > On Thu, 8 Sep 2022 00:31:02 +0800 xiakaixu1987@gmail.com wrote: > > > From: Kaixu Xia > > > > The switch case DAMOS_STAT and switch case default have same > > return value in damon_va_apply_scheme(), so we can combine them. > > Good point. I have a comment below, though. > > > > > Signed-off-by: Kaixu Xia > > --- > > mm/damon/vaddr.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c > > index 3c7b9d6dca95..94ae8816a912 100644 > > --- a/mm/damon/vaddr.c > > +++ b/mm/damon/vaddr.c > > @@ -643,8 +643,6 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx, > > case DAMOS_NOHUGEPAGE: > > madv_action = MADV_NOHUGEPAGE; > > break; > > - case DAMOS_STAT: > > - return 0; > > IMHO, keeping the 'case' makes the code easier to read, as we can find what is > the expected flow for DAMOS_STAT here immediately, instead of asking readers to > find what are the actions that not specified here and therefore fall though to > 'default'. > > Also, my another intention here is to mark 'DAMOS_STAT' is supported by > 'vaddr'. > > > default: > > return 0; > > That is, 'default' case here is for DAMOS actions that not supported by > 'vaddr'. So, I'd like to keep the code as is. Maybe we could add a comment > saying 'default' case is for DAMOS actions that not yet supported by 'vaddr'. > Yeah, it might make sense to add a comment here, thanks. > > } > > -- > > 2.27.0 > > > Thanks, > SJ