From patchwork Mon Jan 9 21:33:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 41172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2392464wrt; Mon, 9 Jan 2023 13:35:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuSu/EoQw4RjxXBiCsCPFpUbt4B6Y6W7qR10906NFBuw2JZ+l7dFVzTC37LHH/R9kiYtZ8Y X-Received: by 2002:a17:907:c58c:b0:82c:3642:79b5 with SMTP id tr12-20020a170907c58c00b0082c364279b5mr57465024ejc.58.1673300151307; Mon, 09 Jan 2023 13:35:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673300151; cv=none; d=google.com; s=arc-20160816; b=dyyWEwEiwlqf8JlSlrGYTTb5Mab+8/4yiWJpmOe2eXdpr4c8rXzTyj9jgbknAHCa64 3mDZOs+qdcrv0LKLOawW+S6Vo+fIZxm4kUGn4aCVCWgjRREpbe0GCFX4rc9be8nELIiI my4mRggWjL+wYBAT7xLzEJ+v3DsBDqxJIgqHvc4RuXIWwHBYxpAu1m5lOmzZRhbv5W2x BUqwa2NB1RXHQY4mzYZt/HeQeOPQHYROFXk6X63MHTGqxb2B7/nN8fbrexG38QM+JLbE +TsafwJlcsXoTQA0NZTwVN0ozLI1UOgJIfhgnWAqr/PpOfOGtYBVCnS16zDXpR4X7Mvc /X8Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb8-20020a170907160800b0084d459379a1si4326118ejc.381.2023.01.09.13.35.27; Mon, 09 Jan 2023 13:35:51 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754582379244161422?= X-GMAIL-MSGID: =?utf-8?q?1754582379244161422?= '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)