From patchwork Sun Nov 19 19:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13460677 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 D9F07C072A2 for ; Sun, 19 Nov 2023 19:49:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 690666B03CB; Sun, 19 Nov 2023 14:49:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 640026B03D0; Sun, 19 Nov 2023 14:49:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4925B6B03D1; Sun, 19 Nov 2023 14:49:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 33DD16B03CB for ; Sun, 19 Nov 2023 14:49:13 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0D4D3A01E4 for ; Sun, 19 Nov 2023 19:49:13 +0000 (UTC) X-FDA: 81475742586.18.A651319 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf16.hostedemail.com (Postfix) with ESMTP id 38388180019 for ; Sun, 19 Nov 2023 19:49:10 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K+BDN5ir; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700423351; h=from:from:sender:reply-to: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=w2h0VsFq1SfFmbRfFbDLLmtclse5HYqoYk4CcDA6qDI=; b=SOti0/c23aEgrSjuL7EwJKehAXSWwoM/jXkYz3oT9+FY5UbnXHA1mYL7jK8NafudifTHbb 71B+ZWIhXLEHMnfTkBXBEAW6JjP1wOPnopuMabFC+A7oQxf32Kc1yhwZ6DrcgBm8xICMS/ cQjXlO6CFscZIVcIVC+RrB5y2wriTzk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700423351; a=rsa-sha256; cv=none; b=tajcWWYmCz+0eJ/WYMXSZvz619EORBf7xKAuEPxUJKkfCsIbHTSr6ml7vNjl2dFuNPPri1 pO9cOXk2O/BppBq5YfooTnLrmR5J2mYx8695y4lzQlgpr7Qhxu8S55EzmF96etd8P1u4cg Nhgd2sy0CQD2DAE2EeromqT/6kNjtqc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K+BDN5ir; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6ba54c3ed97so3871114b3a.2 for ; Sun, 19 Nov 2023 11:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700423349; x=1701028149; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=w2h0VsFq1SfFmbRfFbDLLmtclse5HYqoYk4CcDA6qDI=; b=K+BDN5irpayOSZaoP5h5z+t1k2IVuXlGyPl5WuTQn2kJWx0RC/AuR75FDAXqxH+M9K ujsA7ugjzHbZR3LdOE14lHYH1Q7gK/PrJY+y/bToQbMTkGqqMxnW6+T4gqqi0wvNxdl1 Krq5skWG+JmllHE0ng3yeJ3AyJFkFGMwd2RipCb+/8MUYVgFVFFDCLZSYE+uB8HXqgGU iM427eJ0ZX5j8NPDy9jWnDSE+iC9nCBU/mjQUt1K4TMpmQt9vU0U8VqzBp9ncnP/8hL2 zAaPHgTZ64y4Ha3Yn+Z2oRRrv8Vrct2GxXW19iA58XhygiLlTENixQ02OpTisCACLL6v Wldg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700423349; x=1701028149; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=w2h0VsFq1SfFmbRfFbDLLmtclse5HYqoYk4CcDA6qDI=; b=uoTnbTJJTxC1RvGTmWpaclxHf5QCFpXsL8LuYsmOLvOpdVW+vYgoYRZTrlpgsm39G/ jB0JGsiIz9N8Yl8ebHqGo3mX13/hU25ZzCxlz55z/w/Hi7OoJ6Pu/OIarZIa2WXDTRXW LHU8GaJoY6xz91wwDFOsLfyW5Yw2I40UPzbvMLvvd4Z4Sw25vTobfPq/kREVgh7c2zb6 4w0iXUw6C2QcH4EYUJlp7HceP7dYuMM5ctv8NHeoUdvpqqpyezVBrJeSEpSHC0JlCnN6 adJbXUYAP92lwTB8sISeM3VEI8w14mXNGsYQES3cuhu7f4SzW0KUJ4edHfHXcvdcLQTO 4X6A== X-Gm-Message-State: AOJu0Yw0u2XSgC8uhZ9qwsdR03omM/VQMzwB0ABESbHNLZF/FcybZ3bH yQTa6s76WlY2WBTMSKmI6HIpHzMMyWOmnBog X-Google-Smtp-Source: AGHT+IH7Ef3T9tYhjLf81++NfU6x692Tm7IbNx4ET6n1TwJLp+72WBRurfMYbX3sMqxL34SXbWHpQw== X-Received: by 2002:a05:6a00:1988:b0:6cb:a1fe:5217 with SMTP id d8-20020a056a00198800b006cba1fe5217mr787020pfl.16.1700423349552; Sun, 19 Nov 2023 11:49:09 -0800 (PST) Received: from KASONG-MB2.tencent.com ([115.171.40.79]) by smtp.gmail.com with ESMTPSA id a6-20020aa78646000000b006cb7feae74fsm1237140pfo.164.2023.11.19.11.49.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 19 Nov 2023 11:49:08 -0800 (PST) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , David Hildenbrand , Hugh Dickins , Johannes Weiner , Matthew Wilcox , Michal Hocko , linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH 21/24] swap: make swapin_readahead result checking argument mandatory Date: Mon, 20 Nov 2023 03:47:37 +0800 Message-ID: <20231119194740.94101-22-ryncsn@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231119194740.94101-1-ryncsn@gmail.com> References: <20231119194740.94101-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: 38388180019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: kprz1kqonnu76khdbmfeqtt1c4r9uwcp X-HE-Tag: 1700423350-792556 X-HE-Meta: U2FsdGVkX18B8x2tt9rSY+l4M6iAf5NaPWId/OlHKhSWlCp5XsQnzEy715qxqhEwpdUS63Jk1UHLtYieLs0PHFovLNEZutVaSfql7nEoianMD4evY5Sto1xXg0wKiQh++iF3fORezkhgiS5DvVUsczHar8sorrAh4yxo/S/7JjWn/v/o/VhNzpcBu+THOxl8ECq5ie+HVIZh0bur76QrvceM3XRjLXhX/zoltwgB7bNRKluErHO5szrTckuymZH8n44o0/TdnoukWFqTHtVuhWs3Y3lAkBdGE/8USNoydgwNNYVsDRnf5UsWWX9bgyRTtHQTCu57kBnrqBU57cP6Df3GoCYKGD+5LIHSrdjOz96HRR/vxRT4lvKNQAG44KU8s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xrdRZfsSsdkEyP9DF4QvYSt9yeaR+n40iazstV29zzuXke0qLM4/NLHQzQMxC6SwTu1TAGFXtkU6Gy8I0ayrvmHn/V086MsSgKS8zHBXovDF5cJHZ07upD3FGPA14029uQacWV3vJ2biupGXQVa1a2Q/QXzZDz7uDKhfBBceyYCvzrVwmlvz1RXmbfbeS7dL/cjt1VMFxWx5ZjDNgA= 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: List-Subscribe: List-Unsubscribe: From: Kairui Song This is only one caller now in page fault path, make the result return argument mandatory. Signed-off-by: Kairui Song --- mm/swap_state.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index 6f39aa8394f1..0433a2586c6d 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -913,7 +913,6 @@ static struct page *swapin_no_readahead(swp_entry_t entry, gfp_t gfp_mask, struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_fault *vmf, enum swap_cache_result *result) { - enum swap_cache_result cache_result; struct swap_info_struct *si; struct mempolicy *mpol; void *shadow = NULL; @@ -928,29 +927,27 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, folio = swap_cache_get_folio(entry, vmf, &shadow); if (folio) { + *result = SWAP_CACHE_HIT; page = folio_file_page(folio, swp_offset(entry)); - cache_result = SWAP_CACHE_HIT; goto done; } mpol = get_vma_policy(vmf->vma, vmf->address, 0, &ilx); if (swap_use_no_readahead(si, swp_offset(entry))) { + *result = SWAP_CACHE_BYPASS; page = swapin_no_readahead(entry, gfp_mask, mpol, ilx, vmf->vma->vm_mm); - cache_result = SWAP_CACHE_BYPASS; if (shadow) workingset_refault(page_folio(page), shadow); - } else if (swap_use_vma_readahead(si)) { - page = swap_vma_readahead(entry, gfp_mask, mpol, ilx, vmf); - cache_result = SWAP_CACHE_MISS; } else { - page = swap_cluster_readahead(entry, gfp_mask, mpol, ilx); - cache_result = SWAP_CACHE_MISS; + *result = SWAP_CACHE_MISS; + if (swap_use_vma_readahead(si)) + page = swap_vma_readahead(entry, gfp_mask, mpol, ilx, vmf); + else + page = swap_cluster_readahead(entry, gfp_mask, mpol, ilx); } mpol_cond_put(mpol); done: put_swap_device(si); - if (result) - *result = cache_result; return page; }