Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1495721rwb; Thu, 8 Dec 2022 11:21:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4jCmyAUtkEvoqO8lkZCUaxrWRJR1V++0p8I9PSdoWjzbKaSH02caGXoKLQ8Gnwg5x6as4Y X-Received: by 2002:a63:cc15:0:b0:476:ccde:6694 with SMTP id x21-20020a63cc15000000b00476ccde6694mr66052400pgf.603.1670527295577; Thu, 08 Dec 2022 11:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670527295; cv=none; d=google.com; s=arc-20160816; b=f/5alulWeIxYPs6YkDO4tlim6FzQ/ZvBaPA9G4T2KEZpRu9MI2fxQw/Z7cOqKRSkuA Sp0eDXaghhFAfXA++rQXBEwY59HkwLbxmzJQJvuJfVA0CZJI/EGNdoYlMKlhcyu/8L2J GMNsV/9o0WptUrp5aUfNRVBuOuNc66UHY+UkcL4jJTc0w6S2N71QqwHeylu8VkxyuZ8Y Csq02TNx7augTjpgRaSIP2rSmJV58sGrjYXr2TXc5roqz52ngcM6qqR8FL16uLbV/MjZ T73HNr1T9loc/ttCjeGJCAQBy516B9AW6zSHzqWQRXw6SaEgYsshj4PF5Y7Zw3Thjao2 Mm/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0uwthzCinj77lhOFlJtbRaN2SPsCgH53sRB6S+9jybM=; b=iMswFj4VxNUMjmEb5IaJq7ge/zYU5TzdnSayBUdGLpvnLzQFCw2rNt/0XOdR1MIlTt hLR64SwUIzY3Fif7IGkWUQcCiI4t2z7wXscI0VM3IHk2kyE93D8qLcJGs9TGU1MMStDi InE9atGG32M12gLUXH5TBpyKUXYkzw7eNANcwksQOk8vrNiuP0Wsc/4qhfSmrMttwN5x UeFY5odeelxEblhbpCu7gCnEAAKro2N2T7pVvtcpFNubLn7urfTZzJADken4uVSwu8g2 KrwR2YSPcktfGtzmlUlgZ1D/L2OwqXFGFEXLQ49S2m+Dv77/CJ4gnl3yNO8cEAdjcGES /1vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VhWSQh5n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170902d88600b001898aa48d1asi22172892plz.444.2022.12.08.11.21.26; Thu, 08 Dec 2022 11:21:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VhWSQh5n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbiLHTOj (ORCPT + 72 others); Thu, 8 Dec 2022 14:14:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiLHTOh (ORCPT ); Thu, 8 Dec 2022 14:14:37 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFCF328738 for ; Thu, 8 Dec 2022 11:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0uwthzCinj77lhOFlJtbRaN2SPsCgH53sRB6S+9jybM=; b=VhWSQh5nAy1Tc/aDBJOzNFtxM7 WjDctl7sLwr+V4OTuuhPg33yHaLQOsaUOPBS5dGnQ41UTiwG+xWYuxQojZdyr43uryNXElRdcFKj8 FL7VaY5rrh212pZecIiMNbVDLUWcUR/r536hoGL0U4Ual66QG0uFewHDaNQCPDjNvmCrcmrR+xm/4 qfeZd6yiCIcgW/3tSIwMuw2a8Cd6qfDE2fwEQtHRvy+OkXp48EkQaisLBSQjBZChzNITTgEBVUWb9 9bYhqcwyYVcQ+SZX91AE5oBEd62G9wb3UEgOu1+15SsXr8U1OMhkZ8GuMCd7W8PAsEslKxzf+ydDV nCPEc1VQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3MLl-007ElF-1s; Thu, 08 Dec 2022 19:14:29 +0000 Date: Thu, 8 Dec 2022 19:14:29 +0000 From: Matthew Wilcox To: Kairui Song Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Miaohe Lin , David Hildenbrand , "Huang, Ying" , Hugh Dickins Subject: Re: [PATCH 5/5] swap: avoid ra statistic lost when swapin races Message-ID: References: <20221208180209.50845-1-ryncsn@gmail.com> <20221208180209.50845-6-ryncsn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221208180209.50845-6-ryncsn@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Fri, Dec 09, 2022 at 02:02:09AM +0800, Kairui Song wrote: > From: Kairui Song > > __read_swap_cache_async should just call swap_cache_get_folio for trying > to look up the swap cache. Because swap_cache_get_folio handles the > readahead statistic, and clears the RA flag, looking up the cache > directly will skip these parts. > > And the comment no longer applies after commit 442701e7058b > ("mm/swap: remove swap_cache_info statistics"), just remove them. But what about the readahead stats? > Fixes: 442701e7058b ("mm/swap: remove swap_cache_info statistics") > Signed-off-by: Kairui Song > --- > mm/swap_state.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/mm/swap_state.c b/mm/swap_state.c > index eba388f67741..f39cfb62551d 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -418,15 +418,12 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, > for (;;) { > int err; > /* > - * First check the swap cache. Since this is normally > - * called after swap_cache_get_folio() failed, re-calling > - * that would confuse statistics. > + * First check the swap cache in case of race. > */ > si = get_swap_device(entry); > if (!si) > return NULL; > - folio = filemap_get_folio(swap_address_space(entry), > - swp_offset(entry)); > + folio = swap_cache_get_folio(entry, vma, addr); > put_swap_device(si); > if (folio) > return folio_file_page(folio, swp_offset(entry)); > -- > 2.35.2 > >