Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6830425rwl; Mon, 9 Jan 2023 13:44:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXutAnOV3AKYr5UI26b/ASnu/EPur0ZwBL8qmQQ8ZJbAz9Rs7SuB+C2o5WxTiVOFaGSHFGZq X-Received: by 2002:a05:6a00:4212:b0:583:fb14:ddc1 with SMTP id cd18-20020a056a00421200b00583fb14ddc1mr12405992pfb.17.1673300646561; Mon, 09 Jan 2023 13:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673300646; cv=none; d=google.com; s=arc-20160816; b=plTHukBa2urVFznCRfQFDw8m9MyKwKOa2wwBHi5IL7eYqseRt/87mNaBK8eAmGadJ4 0umMb/bSPaOBXxPXlOOTMPxZQADJDbp63/13DP87risQu3l4BQbCgIXVI7PTT/yTewNx wYyD+77by+l2A74Fet46sAyHY4tGYX/7C3V/eyBseXWqVhsA86XLx0aka1UZYu3AGFpd H+31TT/b3O6WfGhJINaFFoKc0/GJ1+9D/wEz73+AUc78yrXTnbIQ28h76ftLNtF+q4+2 6MfVREydqbH5ruSo2EFkf2QLWXUUuGu9DMkJ2DngWXL3dpxodjX666xPy12Px1yTgYWC CAuw== 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=5UmaNQkviwl/rYu/RYe5B9vXm/PCU7e36YbIXUEXTFM=; b=KiMegcgd1DKIRAkMYq4SdyGXFTbTQcMt/M9RqoBq3zIJEXc/QEzD100x7NT/V8KAM2 KZbnIOdpzZjtOTjWUYa9/6+QK0xbur/rwNust6+I2pNo5U3/7PQqoYHBghdGtzOhojvb SL2Z8//VdL00xaCJ5oaTL+4Rf9Hs8rheafAWcrKmFjrMtwmojLM0xKoXndfsCNiUqRM7 mC4qQU3nS+GX58PNdvthZIfj8b8ivCnU3WZ7Qpwd1s+I0jp4A3lzxClEsj5RFlXWdjUo SqO7EeoOSA2M5qtup3ln2U++Hpp+T/awQic41ZxmN8ZdIUrmuWauOf7H86uOaQxxFcVq /BrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BAy7p9Oo; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a056a0015c900b005833d6e859dsi10787635pfu.211.2023.01.09.13.44.00; Mon, 09 Jan 2023 13:44:06 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BAy7p9Oo; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237616AbjAIVe0 (ORCPT + 54 others); Mon, 9 Jan 2023 16:34:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235360AbjAIVdx (ORCPT ); Mon, 9 Jan 2023 16:33:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8645F07 for ; Mon, 9 Jan 2023 13:33:51 -0800 (PST) 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 A51B2B80FEA for ; Mon, 9 Jan 2023 21:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A46C433EF; Mon, 9 Jan 2023 21:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673300029; bh=yyLlHJ6cCbnE9uJxOcQpPH/RrlJ6RvTE2YIE61/Wx0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BAy7p9Oo4rnxI8GLrmgFxMW8bg3bc0a6rhboNr/pDoTXUJa/1WuxNkcfwiaTal5Qj cJeU1YtDugehNEgYy10tXVIP9704KyIcYqgJB1XPyih1XgdwGsY3yB1jlftCqwGFkh b1BCNiOtBjwFb+W6p7BgsdAx/mZCc5js7lQHXm714dhd8gRHbQG2IVCI8+78jzBRAO mzwvSfk9tmeqxo4dZ2KZ0aYfYzBBBs2Rem1exKOEDzeCUHJ0A5WeVud90fEjHQDPdT wDwFO+awaMRvsIHUIyMf7D6mnO+NeNg60nJs3ADcB6MYMFW9ilQdwN4vbeyLBvwOkd B/ImoIfbYK7iA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] mm/damon/paddr: remove damon_pa_access_chk_result struct Date: Mon, 9 Jan 2023 21:33:35 +0000 Message-Id: <20230109213335.62525-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109213335.62525-1-sj@kernel.org> References: <20230109213335.62525-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 'damon_pa_access_chk_result' struct contains only one field. Use a variable instead. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index b51606519bbd..b4df9b9bcc0a 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -79,50 +79,44 @@ static void damon_pa_prepare_access_checks(struct damon_ctx *ctx) } } -struct damon_pa_access_chk_result { - bool accessed; -}; - static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, unsigned long addr, void *arg) { - struct damon_pa_access_chk_result *result = arg; + bool *accessed = arg; DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, addr, 0); - result->accessed = false; + *accessed = false; while (page_vma_mapped_walk(&pvmw)) { addr = pvmw.address; if (pvmw.pte) { - result->accessed = pte_young(*pvmw.pte) || + *accessed = pte_young(*pvmw.pte) || !folio_test_idle(folio) || mmu_notifier_test_young(vma->vm_mm, addr); } else { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - result->accessed = pmd_young(*pvmw.pmd) || + *accessed = pmd_young(*pvmw.pmd) || !folio_test_idle(folio) || mmu_notifier_test_young(vma->vm_mm, addr); #else WARN_ON_ONCE(1); #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ } - if (result->accessed) { + if (*accessed) { page_vma_mapped_walk_done(&pvmw); break; } } /* If accessed, stop walking */ - return !result->accessed; + return *accessed == false; } static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) { struct folio *folio = damon_get_folio(PHYS_PFN(paddr)); - struct damon_pa_access_chk_result result = { - .accessed = false, - }; + bool accessed = false; struct rmap_walk_control rwc = { - .arg = &result, + .arg = &accessed, .rmap_one = __damon_pa_young, .anon_lock = folio_lock_anon_vma_read, }; @@ -133,9 +127,9 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) if (!folio_mapped(folio) || !folio_raw_mapping(folio)) { if (folio_test_idle(folio)) - result.accessed = false; + accessed = false; else - result.accessed = true; + accessed = true; folio_put(folio); goto out; } @@ -154,7 +148,7 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) out: *folio_sz = folio_size(folio); - return result.accessed; + return accessed; } static void __damon_pa_check_access(struct damon_region *r) -- 2.25.1