Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3192738rdb; Thu, 16 Nov 2023 02:58:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IE69f5Rv/AwbBfZ1cLLRrWUvWi7IgR4pY3q/4vCO1wtV+z5sBBe8UYzv76sre3uuH7czXW7 X-Received: by 2002:a05:6a20:da8b:b0:187:a119:908f with SMTP id iy11-20020a056a20da8b00b00187a119908fmr3033160pzb.3.1700132316741; Thu, 16 Nov 2023 02:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700132316; cv=none; d=google.com; s=arc-20160816; b=IHWm1Othj9PbVB4ETMYxfT4LnhJk6ZCRFZ52/nrAklTi4a7aRAvapapgkrOgKVw/oL 5KTQQbJU9z2PWE78FRMSfiZ2IjOR00CRbAyDkaF8eHDZMFyRSF97W+9TW1yGTivwUYZu JzzLpQJ99i7brmcDq2DOA/8P6Rwg9YdYwr1d6qfRNJUghRumLVeuxkckcRvRlmANBtls 4ZqpFLO9ddlVkbWKVFY9QMqBmt6LSEta+dt0Q4abx3pkwwdvNPqjS8BrDKRnQB7x019K TuWGENL7Dg42gEhykm0BnLIAHiUYw/SaOQ+x2ax3GAOcjHmIznrrjKe6b7nlx8U9qw5q TpXA== 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 :dkim-signature; bh=gQkXl7rSMIGriE3WoQVUpNiOo8++tLYBifbdvtVVhBo=; fh=whRUPkUefz6uYwDXFaAD2XhE3JYci6GYtQh76fC02KQ=; b=jMVqWwBhNzujYqICsLGOYAvtudjMCFlA8sA+bTyJ+FsMpJa/GUK9x3oDf/zPpSjkAD 3rN6UY+HJzwO6DBzzyUPBeV9bZzWH0ZDWuzKGbEAFmjswo4U+TKSEQ5l5PA19nUueYmI bNlGFAV8dmitJAMhK79tHhfhkxq3g1LSRPPIM/7Gr7Dxj/RtW5JkZphBTKHzNyzz+Zme vVQX38G3BpUVMAaXoaKaPgrq5d7PEWwpPRgo49kr4pj9jvENik6DswjmvfSzsQmRPrxx 13Jw6fJuTtKnz/kBUp3MpztK5u1wXct//DYHXaXMkbz3+4Bh8PxFIyryTFtN654ADRxz 9LBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mB07d3Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id d7-20020a056a00244700b006c4d3cd9132si12245428pfj.0.2023.11.16.02.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 02:58:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mB07d3Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E890181C09AA; Thu, 16 Nov 2023 02:58:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345056AbjKPK60 (ORCPT + 99 others); Thu, 16 Nov 2023 05:58:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345048AbjKPK6Y (ORCPT ); Thu, 16 Nov 2023 05:58:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEBDCA5 for ; Thu, 16 Nov 2023 02:58:19 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF16AC433C7; Thu, 16 Nov 2023 10:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700132299; bh=M+8iKSmznVXEZTfGoN0FrGmEHGx1v9DKi1Ga7R7HHOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mB07d3Q7ViI4kjC0hpgE+fXB4OTqUzVdXsyIGTCCGOegiB21GcqULmwnQJ1EeDIBC Mws+buiwIwtecIwYobCeUxKnssn6vQ5jJFacZIp1SVpRNfjzqGSu56oolFFAymOxd7 6k968IkW5nsJSH6lOdfjDPxhRJWlz3P4MipPYJcE0iZF8Gsc20G6DVyEi5VqvyjBT9 n2YHEvJrEgTG1+SBeoKqlZzOp5tA6hca84d8wpMUjP+a2jAXZdtpXeALDYH+rPKhtf QLbNWffvtXyAaQNjl2UeRg9pBIFsPHhoOtKRDMiobAYX2it/qfuly2r8IQe9v+s6Eb oAMaUKeWCv70w== From: SeongJae Park To: FANG2508 <1031576200@qq.com> Cc: linux-mm@kvack.org, sj@kernel.org, linux-kernel@vger.kernel.org, damon@lists.linux.dev Subject: Re: [PATCH] mm/damon/ops-common.c: Fixup missing parentheses Date: Thu, 16 Nov 2023 10:58:17 +0000 Message-Id: <20231116105817.51824-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 02:58:34 -0800 (PST) Hello FANG2508, On Thu, 16 Nov 2023 18:21:47 +0800 FANG2508 <1031576200@qq.com> wrote: > In function 'damon_hot_score', the variable 'hotness' should be divided by the sum of 'freq_weight' and 'age_weight' instead of /'freq_weight'+'age_weight'. > > Signed-off-by: FANG2508 <1031576200@qq.com> > --- > mm/damon/ops-common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c > index d25d99cb5f2b..fc7886c63bf1 100644 > --- a/mm/damon/ops-common.c > +++ b/mm/damon/ops-common.c > @@ -102,7 +102,7 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r, > > hotness = (freq_weight * freq_subscore + age_weight * age_subscore); > if (freq_weight + age_weight) > - hotness /= freq_weight + age_weight; > + hotness /= (freq_weight + age_weight); Thank you for this patch. However, I think the old code is ok, since the precedence of the /= operation is right to left[1]? I also checked that's true by confirming below simple kunit passes. int abc = 3; abc /= 1 + 2; KUNIT_EXPECT_EQ(test, abc, 1); Please let me know if I'm missing something. [1] https://en.cppreference.com/w/c/language/operator_precedence Thanks, SJ > /* > * Transform it to fit in [0, DAMOS_MAX_SCORE] > */ > -- > 2.39.2