From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAA5C433DF for ; Fri, 9 Oct 2020 13:31:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 11168222BA for ; Fri, 9 Oct 2020 13:31:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11168222BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5ADB56B0062; Fri, 9 Oct 2020 09:31:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55C7A6B0068; Fri, 9 Oct 2020 09:31:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4723B6B006C; Fri, 9 Oct 2020 09:31:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 1AD4B6B0062 for ; Fri, 9 Oct 2020 09:31:20 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 73E91362C for ; Fri, 9 Oct 2020 13:31:19 +0000 (UTC) X-FDA: 77352473478.07.owner73_1d18605271e1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 559E51803F9A9 for ; Fri, 9 Oct 2020 13:31:19 +0000 (UTC) X-HE-Tag: owner73_1d18605271e1 X-Filterd-Recvd-Size: 1884 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 13:31:18 +0000 (UTC) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E9E41D92F087A57A3BDC; Fri, 9 Oct 2020 21:31:13 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Fri, 9 Oct 2020 21:31:07 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm/swap_state: Skip meaningless swap cache readahead when ra_info.win == 0 Date: Fri, 9 Oct 2020 09:30:59 -0400 Message-ID: <20201009133059.58407-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable 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: swap_ra_info() may leave ra_info untouched in non_swap_entry() case as pa= ge table lock is not held. In this case, we have ra_info.nr_pte =3D=3D 0 and= it is meaningless to continue with swap cache readahead. Skip such ops by init ra_info.win =3D 1. Signed-off-by: Miaohe Lin --- mm/swap_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swap_state.c b/mm/swap_state.c index ee465827420e..b9013c3f94c9 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -839,7 +839,7 @@ static struct page *swap_vma_readahead(swp_entry_t fe= ntry, gfp_t gfp_mask, swp_entry_t entry; unsigned int i; bool page_allocated; - struct vma_swap_readahead ra_info =3D {0,}; + struct vma_swap_readahead ra_info =3D {1,}; =20 swap_ra_info(vmf, &ra_info); if (ra_info.win =3D=3D 1) --=20 2.19.1