Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp19771rwn; Wed, 7 Sep 2022 19:03:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4eZHmGeBmYD5pm+hJsHFeUno9EpfWc+8CNTPB2ukAsJglIlsz1TXDScxta6RPS9JgQ05Vj X-Received: by 2002:a62:168a:0:b0:535:ff3d:b68d with SMTP id 132-20020a62168a000000b00535ff3db68dmr6640490pfw.86.1662602636307; Wed, 07 Sep 2022 19:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662602636; cv=none; d=google.com; s=arc-20160816; b=raJsDJhvGYgShYicdxU5PrdKLE4k783JwWzNei58OI7+98bhHT5C4OPxEx7moUqNS0 TBD0gaqJB/ifcwzCNnTIU7iRZnUXTaFvTY1cq1+yLDDM4cCqJnL8hfjJgA55+w3s2jYd 9ymRkf6u7Kgv/r6VVmAaFDl9TwdxjmPCED2vw9MO+WeSVK5lErUXzYradZvw8ZBcWEVl RaZLFq9XvSvnn/K0IJYwEwkHaY9ub0wi8S5hC/Jt9ULywzQzKdegWxU1DJPs4bfUiV05 1lH5Q8vbZcYQNqTx5kOGU4DwmyiVwchcLZ9PzyOu5LTz9Plh9J/v6ZgGIH8xiXWOGq5u 0p6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=p8NDzMUj2L04r2vPACFHxlnDZT1GV0FPFDn+hFd/PIc=; b=NUPV+aqu0ZxiXXEfJ+afYmyf6jVV3iCjzpLGp/OSABrKjXu9/10LNTxz08KesDebQU H6kNpRPsW8H91sjnmHdAASZWkMMJ3VRHyL781qScxTQjCklwrZlq5OCuFvlkgsC9gYS9 CZYLZbL5y+ELUnCG1ykrTtHPS10OkLCNf/wpiGXU7AgEJ9leLEQT+XJwHUQEnxAJ2t76 ocN0Vmix8lFQHK7qWB9PtYEmTPWzf3IkZ1v0kVnAiNEjNLTtuhoZRTZ60JZMSh5Q26ro sfQ6xjBfgkGEHYXtvyhdqUb8+xnxkc13WnjLDomzG5yBz8R/ZLZNjk1/R/d3dNODs+0p FRlw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip12-20020a17090b314c00b001fac80ecd20si1008184pjb.61.2022.09.07.19.03.44; Wed, 07 Sep 2022 19:03:56 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbiIHBn7 (ORCPT + 99 others); Wed, 7 Sep 2022 21:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiIHBn5 (ORCPT ); Wed, 7 Sep 2022 21:43:57 -0400 Received: from out199-15.us.a.mail.aliyun.com (out199-15.us.a.mail.aliyun.com [47.90.199.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20797C7435 for ; Wed, 7 Sep 2022 18:43:55 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R221e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VP.zpTy_1662601430; Received: from 30.240.97.117(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0VP.zpTy_1662601430) by smtp.aliyun-inc.com; Thu, 08 Sep 2022 09:43:52 +0800 Message-ID: Date: Thu, 8 Sep 2022 09:43:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] mm/damon: Remove duplicate get_monitoring_region() definitions To: SeongJae Park Cc: akpm@linux-foundation.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220907205911.62483-1-sj@kernel.org> From: haoxin In-Reply-To: <20220907205911.62483-1-sj@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,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: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/9/8 上午4:59, SeongJae Park 写道: > On Wed, 7 Sep 2022 17:27:12 +0000 SeongJae Park wrote: > > [...] >>> diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c >>> index b1335de200e7..01938f33038d 100644 >>> --- a/mm/damon/ops-common.c >>> +++ b/mm/damon/ops-common.c >>> @@ -172,3 +172,31 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r, >>> >>> return hotness; >>> } >>> + >>> +static inline int walk_system_ram(struct resource *res, void *arg) >>> +{ >>> + struct damon_addr_range *a = arg; >>> + >>> + if (a->end - a->start < resource_size(res)) { >>> + a->start = res->start; >>> + a->end = res->end; >>> + } >>> + return 0; >>> +} >>> + >>> +/* >>> + * Find biggest 'System RAM' resource and store its start and end address in >>> + * @start and @end, respectively. If no System RAM is found, returns false. >>> + */ >>> +bool get_monitoring_region(unsigned long *start, unsigned long *end) >>> +{ >>> + struct damon_addr_range arg = {}; >>> + >>> + walk_system_ram_res(0, ULONG_MAX, &arg, walk_system_ram); >>> + if (arg.end <= arg.start) >>> + return false; >>> + >>> + *start = arg.start; >>> + *end = arg.end; >>> + return true; >>> +} >> 'ops-common.c' is for code that common in monitoring operations >> implementations. I'd prefer to have yet another source file for the DAMON >> modules including reclaim and lru_sort, say, 'modules-common.c'. > Or, putting it in damon/core.c might make more sense. Ok,  i will fix them in my next patch, thanks. > > > Thanks, > SJ > > [...]