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=-3.5 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 1B1C6C2D0A8 for ; Wed, 23 Sep 2020 08:02:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 456FB235FD for ; Wed, 23 Sep 2020 08:02:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 456FB235FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 805346B005C; Wed, 23 Sep 2020 04:02:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B6696B0070; Wed, 23 Sep 2020 04:02:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CEA46B0071; Wed, 23 Sep 2020 04:02:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id 588A06B005C for ; Wed, 23 Sep 2020 04:02:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 14EB9824999B for ; Wed, 23 Sep 2020 08:02:39 +0000 (UTC) X-FDA: 77293584438.30.stage37_57179c627154 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id CEE15180B3AA7 for ; Wed, 23 Sep 2020 08:02:38 +0000 (UTC) X-HE-Tag: stage37_57179c627154 X-Filterd-Recvd-Size: 2271 Received: from mail3-166.sinamail.sina.com.cn (mail3-166.sinamail.sina.com.cn [202.108.3.166]) by imf01.hostedemail.com (Postfix) with SMTP for ; Wed, 23 Sep 2020 08:02:37 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([222.131.67.153]) by sina.com with ESMTP id 5F6B011100013BB9; Wed, 23 Sep 2020 16:02:32 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 89332854919774 From: Hillf Danton To: Rik van Riel Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com, niketa@fb.com, akpm@linux-foundation.org, sjenning@redhat.com, ddstreet@ieee.org, konrad.wilk@oracle.com, Hillf Danton , hannes@cmpxchg.org Subject: Re: [PATCH 1/2] mm,swap: extract swap single page readahead into its own function Date: Wed, 23 Sep 2020 16:02:16 +0800 Message-Id: <20200923080216.5240-1-hdanton@sina.com> In-Reply-To: <20200923063243.GA17027@infradead.org> References: <20200922020148.3261797-1-riel@surriel.com> <20200922020148.3261797-2-riel@surriel.com> MIME-Version: 1.0 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: On Wed, 23 Sep 2020 07:32:43 +0100 Christoph Hellwig wrote: > On Mon, Sep 21, 2020 at 10:01:47PM -0400, Rik van Riel wrote: > > +static struct page *swap_cluster_read_one(swp_entry_t entry, > > + unsigned long offset, gfp_t gfp_mask, > > + struct vm_area_struct *vma, unsigned long addr, bool readahead) > > +{ > > + bool page_allocated; > > + struct page *page; > > + > > + page =3D__read_swap_cache_async(swp_entry(swp_type(entry), offset), > > + gfp_mask, vma, addr, &page_allocated); >=20 > Missing whitespace after the "=3D". >=20 > > + if (!page) > > + return NULL; > > + if (page_allocated) { > > + swap_readpage(page, false); > > + if (readahead) { > > + SetPageReadahead(page); > > + count_vm_event(SWAP_RA); > > + } > > + } > > + put_page(page); > > + return page; > > +} Check if put_page() makes page a hot potato at the call site on the v2 spin. >=20 > I think swap_vma_readahead can be switched to your new helper > pretty trivially as well, as could many of the users of > read_swap_cache_async.