Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1822487rdb; Sun, 19 Nov 2023 11:50:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHlkOWi9tp3LQKFUkJ2iZh/wqEjnbuhWM/Q/Y18sdqIjW4xeBScnWAb8k/+A8GEF/r1Oe3 X-Received: by 2002:a05:6a20:c1a9:b0:187:da70:62f1 with SMTP id bg41-20020a056a20c1a900b00187da7062f1mr7198966pzb.27.1700423428030; Sun, 19 Nov 2023 11:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700423428; cv=none; d=google.com; s=arc-20160816; b=jAAFgG9DntKLLhMfuSHXd+cL3LSYUhthKVPBqOmlqntdxoGzrm/7QW0wi0G6WPC1cL BHFHvH0ymr7r78OwcouwGcf0L4lrlt7by1OT0Tv7VsmAYS05FDYqfOBXWQvgIMuYE90a gYbgsmBm5iLZ3yJ7PmRMOmNa9lMW00Z6WXLv+S5WynT02NJDCNvaXPMfM4iEnBjM213Q kEGpOs4NfE3xv/VvJA26rOoyl24hxpXyA6UYCgfYsXGMPZXok9LTqbTiRsulfN568Yp5 LTWHyESr754IzqnMevFBfWSpsiB74GFCjihHhXynEAJo7kea1uWTyCMOoQH7dIUWbkw9 zA0g== 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:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w2h0VsFq1SfFmbRfFbDLLmtclse5HYqoYk4CcDA6qDI=; fh=4HE/piJoUCKuBTCCBiej4//zvvzywHdOLL9QM/KYjYM=; b=mVVNRmDOX+T1iRwgq+iM/f+rB0WCeyJDK+24e0peDnal/mjsFtjVUvgMgK4sFnflj4 tjleKjkIp/zxJRRgGpLRc7FW/kjiOVRVJgkgD4fTKY4Ln1FxahPIX0jrqAQLNk9iMlxX xz7TJEGPkbjz97E4yteFVNlEISqZzVlSw67Dr0NvJmN8Eg4T4sf9w3+0AN0ZAQS8KthZ x+ehA3siSXv1bZw7cGti6rVn6NBB6ZWGT+TZgEj7Gx/AFyqrZwoCmSJ9TjOScY91cFcd 4W7i0OfCiHgy55/NUv/Q0qlkdA4oWBhJZ/b0ZcjsnJBknh7Zxa4oQdIgn1e2CQFWLLxs OYnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kPVLQgwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h9-20020a656389000000b005bd3b016f84si6312054pgv.24.2023.11.19.11.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 11:50:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kPVLQgwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A41F08040EA1; Sun, 19 Nov 2023 11:50:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbjKSTuM (ORCPT + 99 others); Sun, 19 Nov 2023 14:50:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231748AbjKSTtt (ORCPT ); Sun, 19 Nov 2023 14:49:49 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1671B1704 for ; Sun, 19 Nov 2023 11:49:10 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6c115026985so3870434b3a.1 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=vger.kernel.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=kPVLQgwQevJOFiEY0KJ3SPO+qeDa6dHv8o5dvT8mV5RwVnvACWUcAZ09RNYS17O0uJ F5rUlZSZYZJSP3McplnFbayZBp3zJi4oniSKsO9H8xecRURD72zLnK9uzZs31NqN+FrE LF3atFZV3hgZHgdhmuSJ/RuCscN2YzlkQSPcYOHSmqnb3XOY4MxFL9qBy51K9+1mQPoZ ck8UYcQqX568dEFMmZBWVs8elpC8wi4GDirZVqtBxZVK4E8o5R2ZNdLTL325oViQy4W9 F/gRx4taMjSmqYErjPpedjaO3X5zf6tTBo8pad0BnIk+u5a2JlxqT1YPZpkEs9kWg3oO DkqA== 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=A7tSNiJiiEpGtL4wf3bUp04p93syIY+rRQWQ85OXb2xmPneZKkyvnfHYM5FJDbkquE CI8nWL3aQUeKRJ0mFVlGEhFZmjh2w9tyeP4s9CouR1MbVbNKSGw/qL40EDAjTsRCZ5SM UmmsBrck9jpj8k4NwP9LjEnfpA7bhCjb52Ub40P+EGJVcksgPS5qnKzc2oXMmrwyeEc/ OXZC/tQZ8TMXHJ9tf46ywF/bIrF9WdsdSE8QO5Ym0wJm7ik1FAn8t7m7KJsTjWRbTIqb z8nohzw1pKOkZO/Bgvz3Msl6mcL9elP6jIQtQ6i2dKhbrpv1aEXA5zSjnQUxhiMqaWLF lggg== X-Gm-Message-State: AOJu0YwroDZ4VCarqa6mw9jY2e/KLe3DLC7JbleeCYdZueQkAEC3fOPZ aITERZ1MYRnVW15rOoI5zq0= 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 19 Nov 2023 11:50:26 -0800 (PST) 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; } -- 2.42.0