From patchwork Tue Jan 17 23:16:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 13105217 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 5FBC5C38142 for ; Tue, 17 Jan 2023 23:16:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E096E6B0071; Tue, 17 Jan 2023 18:16:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB9206B0072; Tue, 17 Jan 2023 18:16:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C80C66B0075; Tue, 17 Jan 2023 18:16:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B3F116B0071 for ; Tue, 17 Jan 2023 18:16:42 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 774581404DD for ; Tue, 17 Jan 2023 23:16:42 +0000 (UTC) X-FDA: 80365852644.03.026CCD6 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf11.hostedemail.com (Postfix) with ESMTP id B5BFF4000D for ; Tue, 17 Jan 2023 23:16:40 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kOHVN4iC; spf=pass (imf11.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673997400; a=rsa-sha256; cv=none; b=LeCC2uZAS2VBE9JftSsxhuMuWA1Ut7gdNGwD7Wr3aDPfmGha8Jb2GtDSGl4Eu0iJry3P6G zhQc3c3IIWL/x4ZnBjW6r0tJwCcutvU4TSBFUiHxCMBe68SRG9t0+Ny6J3zf223VlNRUD4 7XY9jfiD9I0eGu2NjFyt60rau+8WNZU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kOHVN4iC; spf=pass (imf11.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673997400; h=from:from:sender: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=gTiyHD7Ef/752rEDI0F/LBvIYY0+LQDTJtaLZSqbVXc=; b=US2mLofmiGjpj1DUSYQL3t8kaDbsEp8Hobl1zSAgTZ3Vx3W+VbpDh1mpFh1NGC1WgjwE8n Kh7oXaYQ8zsC2qPIY8heMl5TBws26s6sg2ZY3PQBKcJHYSJ+TD6M9TUvuGd/nK4LxMDZyT RlzQZtWRxCbDHKq0x01aji23ss3hWsw= Received: by mail-pl1-f173.google.com with SMTP id z13so7308405plg.6 for ; Tue, 17 Jan 2023 15:16:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=gTiyHD7Ef/752rEDI0F/LBvIYY0+LQDTJtaLZSqbVXc=; b=kOHVN4iCCmfxv/zeMoeqp1NIDCtKrp3hBek5mMJSon6a/fiUKWljfakQaTg8gv/rm0 FcO/VFOYSl46GbdZAOp3L81OQ4NMnkVuIngOcoBNCdGaqrkn+TT90/HU5K6Gb04DIXum Pug1+4LyQZeU8NUjAmeV6W7wHa/IaFckbaRGSRS1nRrfsTqTFlfbqkfiRdW12W5fb58v qJkso7ivSEnXfhkEJnroxGe/+H9/8mY0Niyj9Qv5ADD5cCEqkbgjg3fzZ4bCmCJP4FRu wtDP3Hy4Y9yo/qv/9lu6EzoAdy98bMM/ElSSd8PhoeKIc8t0VVQSilNV6W9GsG0LUmqs P12g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=gTiyHD7Ef/752rEDI0F/LBvIYY0+LQDTJtaLZSqbVXc=; b=7tH94g6NZAn7IRn34noOYuFxPQIvoew/FZ3rGf+jcjQC/vE2/iEPRAnGXyhdeiw2A/ YZgRkuHRfQq0lOIeAgeiyBzgeq7nMU06l7JcUibb6h/dgnp6eBdc8gUdMVxFwaT2w30b AMLe9mqqObLDEsGs3BFaE38Ulwd03WhlB24rD0UzNqC7yllsQuwb3flpRW8/k/25i480 /q0AZw6jyVBF6R6rvesi90fpyGce1mg4IDgGoQUli7qucfxjyMdjD49MjU93QP8SfkBg wuBzv/lhlW5CleogNvAm8Qrtm9wgYVjeKKnXGMunrh14d1ZGkAS9c36z/pqUcDlhQwJ8 MR1g== X-Gm-Message-State: AFqh2koXfELF2UO+mp3DHluq6NL1EBVJAotf3IBoHEyIBudRR0Pxwbac 9J2ldVsLZ8K+ldyBITVbP/I= X-Google-Smtp-Source: AMrXdXuoGPnt0eAYkj7iSPPjbAuqd8tFEbpGverST+idm85MqQnUhGUuQkjo3Rol7XmplIK3mdIY8w== X-Received: by 2002:a05:6a20:939f:b0:b8:99e3:4835 with SMTP id x31-20020a056a20939f00b000b899e34835mr5398685pzh.17.1673997399645; Tue, 17 Jan 2023 15:16:39 -0800 (PST) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:201:27ce:97b5:ee13:dbfe]) by smtp.gmail.com with ESMTPSA id c24-20020aa79538000000b0057447bb0ddcsm5180965pfp.49.2023.01.17.15.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 15:16:39 -0800 (PST) From: Minchan Kim To: Andrew Morton Cc: Suren Baghdasaryan , Matthew Wilcox , linux-mm , LKML , Michal Hocko , SeongJae Park , Minchan Kim Subject: [PATCH 2/3] mm: return boolean for deactivate_page Date: Tue, 17 Jan 2023 15:16:31 -0800 Message-Id: <20230117231632.2734737-2-minchan@kernel.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230117231632.2734737-1-minchan@kernel.org> References: <20230117231632.2734737-1-minchan@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: B5BFF4000D X-Rspamd-Server: rspam01 X-Stat-Signature: p31i9jjpp3w4qz6asfe1egnnf7dujsuz X-HE-Tag: 1673997400-722789 X-HE-Meta: U2FsdGVkX1/GcwG6FkNpIorlysiJpKcEiJtMXDr/0H7BHmlrMDK2+9ceZoMxGwDNUinucEzsx+Sx6wyLl/qyTCoNNjwVxad2LhLtl4URfs5qXStZsT5fC3db1+0CGRZHVQmY4gq+NhTQ9oud4uAeG3L83J4m2UoDh0PWGO66YJsG+Jcd1QgK3wTB3QfqTY057J6hfF+pQAuqdEBP1gg3tjF8G19gc0i3FNk249ZqralkoT+EPV2UeicaqeUsf1IY0k93jUPLzPQ1+B9pG86LIUIG7vcjRaaiFB9+ArA6PnMtCMX3qyJ6zp4F6Z4N7IoiAvWQtQKpPADZfMdhhyL+aN0DdnqV6vGdM48wYUR+R34lzYIH9Nm0MuXaClraQqSp5ez5fULPmYnlurS1U1hLKj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precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Returns true if the page was successfully deactivated. The return value will be used for statistics in next patch. Signed-off-by: Minchan Kim --- include/linux/swap.h | 2 +- mm/swap.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 0ada46b595cd..803e5fa4cd86 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -409,7 +409,7 @@ extern void lru_add_drain(void); extern void lru_add_drain_cpu(int cpu); extern void lru_add_drain_cpu_zone(struct zone *zone); extern void lru_add_drain_all(void); -extern void deactivate_page(struct page *page); +extern bool deactivate_page(struct page *page); extern void mark_page_lazyfree(struct page *page); extern void swap_setup(void); diff --git a/mm/swap.c b/mm/swap.c index 955930f41d20..52532859c05b 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -725,9 +725,9 @@ void deactivate_file_folio(struct folio *folio) * * deactivate_page() moves @page to the inactive list if @page was on the active * list and was not an unevictable page. This is done to accelerate the reclaim - * of @page. + * of @page. If page was deactivated successfully, returns true. */ -void deactivate_page(struct page *page) +bool deactivate_page(struct page *page) { struct folio *folio = page_folio(page); @@ -740,7 +740,9 @@ void deactivate_page(struct page *page) fbatch = this_cpu_ptr(&cpu_fbatches.lru_deactivate); folio_batch_add_and_move(fbatch, folio, lru_deactivate_fn); local_unlock(&cpu_fbatches.lock); + return true; } + return false; } /**