Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1024439iob; Fri, 13 May 2022 20:04:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVWXLt613fzH5X4FuQc4UGfKhYicDQ29E1E7ZXgJvB9Rt5pm25gRToqHoW0rpgmCSaXNTG X-Received: by 2002:adf:fc4c:0:b0:20a:d9d4:5f30 with SMTP id e12-20020adffc4c000000b0020ad9d45f30mr6024441wrs.578.1652497471866; Fri, 13 May 2022 20:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652497471; cv=none; d=google.com; s=arc-20160816; b=DC11D8EVuMEebQE/pfKSGV3ehHpgXvlbcUH6pzJL1i+8w4GbDi6BhhqEl05SWG46M8 aRcaBFuVECu5+YZyDXzWdhb36SNAXNspFO7JEd/yF30KphBL1oEJljQOoH79qAT/PFJV 6WFbQBAYdkzXXRR99oxXHMZ6M2Iw6k6MACiG0dBHFh9HDX2129TQs9sTaZt94AJd0AiQ 21zGrZIHynuMvZcrvDvijLbbt5qwOH4HwcPAIhcuVvTGS5MgoE9m0Qa9WI2H4tM1DCxl +PMvuRsxZBtQwFSWRhxEl00BIJR+b7OWAX0rnT0xyExVosRrLbRUbSUcO7oO80xXz+E0 bt7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature; bh=fJuTunWT6tNpp5zKyKjM4zlKgqd4gNACMA2Zw68yUb8=; b=HZx0wprfhWM2KODRrOVl8Ok5Dfj0Bm31VUNSQcuS2UHtEzTbTzbbN9Z6txpxGCjrfh pbInOIZidIgnhgCjrOq5XODQqqW8A0OTFz95PNVNW0b0Y2gW38pDBCRg5ntlD4/0aRpz 2zDQMvoQUbWwyrXS14v/3CssxJrW+HURmZrK9aRU5uSrZVPgZrw13oSnjAtp2zQ6wW01 ZITmzBfcn1QPqGSfslwSoRkZB9FkBd7ZJP2T/AaOSihlU3rUNkBCEBMB2VHQZWrsBHAa 0qnLZF+cZzoiQjRA6nkK4LZ2TzR1rsFR4+5haokLyTYU9rEWRWhoa1l07SPKTEhpaHr8 kaIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=JVD2EDqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r2-20020a5d4942000000b0020cdca117aasi3338187wrs.227.2022.05.13.20.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=JVD2EDqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7CD203AEF61; Fri, 13 May 2022 16:46:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381680AbiEMPBt (ORCPT + 99 others); Fri, 13 May 2022 11:01:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381875AbiEMPBL (ORCPT ); Fri, 13 May 2022 11:01:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DB547AE2 for ; Fri, 13 May 2022 08:00:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08A3BB83029 for ; Fri, 13 May 2022 15:00:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB7FC34100; Fri, 13 May 2022 15:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652454033; bh=11GGetY1wDUykE5Nyy58CKhxn3If/B0NbPr4dqjZJhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVD2EDqRC51IxA65gs5McXHnMkTqUbN+hLAkSkMsvfpKfy0uENX8P6re5sXBCv5Vn oFpMKegP2kxpOaZ5b++DfDafD2GzJhb0OA0WK/T5gno8MBmL0FUtleA9BeuRWornnB P7yHSCGIkFU7Nzxbu4i62IKOymu7BaVxzOi+y6WXDToTPtLqtiBLWBQsA09K+LAXzK sfFXKRNfF0MUyjurphbZZ5UfQjInipxl2BKx9BSf2KS6HmRE6bXzrwMUZbgF3fC4cQ KODfYyVmTFB1O9V3T0oVTjzkZwvSY6HmR69GzF3ffAbeL3tA3l+8+6hXf644IStnHY fsw74HIIbXkjg== From: SeongJae Park Cc: linux-damon@amazon.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [RFC PATCH 1/3] mm/damon/paddr: move DAMOS_PAGEOUT handling to a separate function Date: Fri, 13 May 2022 16:59:58 +0200 Message-Id: <20220513150000.25797-2-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220513150000.25797-1-sj@kernel.org> References: <20220513150000.25797-1-sj@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit moves code for DAMOS_PAGEOUT handling to a separate function other than damon_pa_apply_scheme() to make damon_pa_apply_scheme() prepared for later additional DAMOS actions support. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 21474ae63bc7..08deee12ebfd 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -204,16 +204,11 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx) return max_nr_accesses; } -static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, - struct damon_target *t, struct damon_region *r, - struct damos *scheme) +static unsigned long damon_pa_pageout(struct damon_region *r) { unsigned long addr, applied; LIST_HEAD(page_list); - if (scheme->action != DAMOS_PAGEOUT) - return 0; - for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { struct page *page = damon_get_page(PHYS_PFN(addr)); @@ -238,6 +233,19 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, return applied * PAGE_SIZE; } +static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, + struct damon_target *t, struct damon_region *r, + struct damos *scheme) +{ + switch (scheme->action) { + case DAMOS_PAGEOUT: + return damon_pa_pageout(r); + default: + break; + } + return 0; +} + static int damon_pa_scheme_score(struct damon_ctx *context, struct damon_target *t, struct damon_region *r, struct damos *scheme) -- 2.17.1