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: 13094370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86856C67871 for ; Mon, 9 Jan 2023 21:33:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75AE9900003; Mon, 9 Jan 2023 16:33:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 730F6900004; Mon, 9 Jan 2023 16:33:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D025900003; Mon, 9 Jan 2023 16:33:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 40DDF900004 for ; Mon, 9 Jan 2023 16:33:52 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2395CA0544 for ; Mon, 9 Jan 2023 21:33:52 +0000 (UTC) X-FDA: 80336563104.04.2912ED5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 80D58C0016 for ; Mon, 9 Jan 2023 21:33:50 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BAy7p9Oo; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673300030; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5UmaNQkviwl/rYu/RYe5B9vXm/PCU7e36YbIXUEXTFM=; b=CMqM3v+deDm8u/4ntD4r/8uB1fcFVoPbeznwjzDRyqF9pBofsSkzmnzKyThjDLszW8JWJe 1zAL+bIL3Iy1B3poQe/fQvLi4BR+yKyBkVrxU24woo/0qEPEOuRfCqC+AmGcm3gnlHh+hf xgTqoq35sfSRg16BcM2E4MxtXigRI20= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BAy7p9Oo; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673300030; a=rsa-sha256; cv=none; b=uvnumTQNorWhWZSGIoirnaCISEJw7ZUKng5k68wSHpHWqQUd4Fo4oyi+MZD5kA77ZJofas Ong1OCMpaVM3e0oBDA3sw9YY35i+3hYmIwOT93te5e2rwcY66nirKW3kNH1x21253cBtDB CqHZ+YToRtrGCyKuz0k6oXWD6FhUZHc= 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8A393613FB; Mon, 9 Jan 2023 21:33:49 +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-Rspamd-Queue-Id: 80D58C0016 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: sdpxjt6qh1hms5frkmwziapj5hohg84q X-HE-Tag: 1673300030-658281 X-HE-Meta: U2FsdGVkX1+yvm5l4UnaHsZOw3u7Fk7eVhnpo8F4k4dHJDqoG+0DXju6nlCYS6HPZ3/82+d9ZMY8vWiRIppDHTRf7bkixMFrJBFsvQzNQMLoigFoplq+8P/RRBYMDU0Tp1d5YUP5fwIZHfijcgb2Y3LKYsxZpgCLvzSYnpWsIKCVGxudXR6Lpd8a4dfJh7EY8gK1TV2UAihYosa7PHqBCjy+WFTEijed221dRFmLvDUGvR9KAMWWlgZ/bbr9/vlIMYyk9GcPkTtG4xWPynqKRWZIE2ry74Gty4OBSPMROnKnDzIMBW+Xf5xIlHpTo/f3mqclFMHhZb3otSHKB+LqQxP7NWyv7nbun6AusJ7L7oZ1yJxG2c1Drmoy+PgOQ7nOK05YqLOE9bnVwEn0TaeLDtLndgRtuf8qWDpSTcAo8yP0dUxPBMDmT3+mnQoMNQL0F/rwZjEAmVmXaJ71WXwlvismRzT4nO3lzV3Wyr99GNCTCmkoyrrOooqbMC8una6PJbGwdXTHhoX+z+GA1JVMCbGor7VmvUBAkp/Hvrc5Loy0u6um5QrjxOpf6kxjTeg4k9goUUpYGVThhi2UT/9TdLSiU8Pau1Y4NT+zPDmSena237cF8W2sKItSaGbNLI7JDHpPkdxSOnpmkISEi1dICtuVQizGnI8ec9A/uX0nDituxFZEh1qCx0g0DvJhcNEClC3HK7MVFdzpkbMeao/mTGxGJX8prcF/wn54M4M9irMf+DWk5bTsYMJuuTHb0AfJXRz1jQjCdyGY2wZWDlI6JSrOmCVskpa0UxLaShOexvIjrEZ+SJsFYdonPUP/XUOLUrzR2vnknLulMnw9MmQFTOv8iJ8nogP8mrhZsPZHJSfRb3OiDE0/U+knniYSPBQmq0ad9uEIJH2A8tMXYJYe0DxgmaQpwasYTS0oISw8ZZJA1ngAQvHedRy6Mt5jRxUhursw3Oy6QxVflspiEqK U2cbf8eO k0ilIzCUIMGlzgc2cnuVNVs7bTUfHQO1Pk9iq/WW8lxDg7OLQSDpixQvHqC2PpyoyGhmjjcDTijed2g/GikqCoLZUpG4yllDYVcKcuCM2PqJKMu0kFjpZVq+jJg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: '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)