Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5643884rwp; Mon, 17 Jul 2023 07:24:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlGN8pH2UBuEl2W3xISHNi2TERiIUV9qMQy3GmWQ7HkhTeHEUgtFlKJxSB9UGz2kvYtjh6Lj X-Received: by 2002:a17:90b:4a8d:b0:262:e84f:ad80 with SMTP id lp13-20020a17090b4a8d00b00262e84fad80mr11794692pjb.9.1689603897589; Mon, 17 Jul 2023 07:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689603897; cv=none; d=google.com; s=arc-20160816; b=dvgYbxsWbN2QzsITMWP6M3FhJpiDquGKUMCl0vqaU4NXubErCJHyDzqJM9oOw2ALoU 1WmF7dkD4fyTZtgKqCIbpl8rf914HA1aSwa6NXXQRF2H09kvqr2FXYD83BMXO2M4w2b4 SlVY7ZvicBhZmMCmrAOPfqIAlQ8aPwLAjVH6u2WamtemW0cm6M7cuKidUEU0RX65WkCV zQUvz0RHrIRF+fPda0AO2eBhQg6nU106n5f344n468B8r3EKnbPrCZBZeQk9MMMfRTZs VNoQ+mkhpS8M5HjCB3Fm6SQav84T+DFZPtKPgGVIRzudlf9wsnfEpoSIA5dmAn1GV9tY l+FQ== 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=OjcJNfI+ZFsjHCpKJy4DcI+Lam5MgEbyR3vKrF75hvk=; fh=LfU61JblLnjgLIppk/WuQ8BD9DwNgE/2eB/ftlKkq8Q=; b=ohsDco+lQL+1+XK6D75W38pm3imT9HMA0Vlb2K1tv7TPEzD2R01OqnlgTUep9vzQNV 2k9nIBrZ8SxvooWCyCeqOmDrpPp4AhEcAZDl/7BTxcZ2qX1jmqw/UArh+MAgGTtovwzM KOfjd/2u3tQmiHh7H0eNPJR9oVAW1sSDjKr90ziPkMNn2JydxYZqXPDrBIf0KO2F05Q2 eieHPqV2Ksf1TD5rLS4grnvvyBS9cAzIxJ+pcF7iYTJswzkcRJcztWbbq8EaQL+yWtnU YJ/R4hg93gILtthOsnydZD4/IvTyE/MvDGWK3xZWTHM3hGoeLA4q4O5vyuCWspaZ3yuy disA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sNqY+OXh; 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 nk7-20020a17090b194700b00262f99a851asi5599183pjb.96.2023.07.17.07.24.45; Mon, 17 Jul 2023 07:24:57 -0700 (PDT) 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=sNqY+OXh; 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 S229749AbjGQNkf (ORCPT + 99 others); Mon, 17 Jul 2023 09:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjGQNke (ORCPT ); Mon, 17 Jul 2023 09:40:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8313BC7 for ; Mon, 17 Jul 2023 06:40:31 -0700 (PDT) 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=OjcJNfI+ZFsjHCpKJy4DcI+Lam5MgEbyR3vKrF75hvk=; b=sNqY+OXhxUClUB7xAXZjrPH1lI K8RGdXd/0ZJ0S/l/tgC75d5SD4NAXz2xUVxkjo9mxF4syd2zpTJliExEkS8h2RvcA2/VM3NjJVq6+ OrRwUsB5HenSqG+hYhnc7m8xxupgc5Hk+Ii156mpISEZ12TzRtc12zzivIMrPQDE6Ukx52UzIgYih 6TbOYeKc8jlO/ZwlcWaPSnFIO82K5RRjLOMxq1DWLq3/lmnm889qsXf6iBofzWh55d42tR32w8o49 PS2wTnPuONSl5T+c+oyCKteKMMjBvyOa+IRZZGeBTx5Va+k7KeH4KmG+GIcbDlnIHjsIJoT3JX7m7 u9cuIfbQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qLOSe-003xHn-Al; Mon, 17 Jul 2023 13:40:24 +0000 Date: Mon, 17 Jul 2023 14:40:24 +0100 From: Matthew Wilcox To: Peng Zhang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, sidhartha.kumar@oracle.com, akpm@linux-foundation.org, wangkefeng.wang@huawei.com, sunnanyong@huawei.com, Kent Overstreet Subject: Re: [PATCH 2/6] mm/page_io: use a folio in sio_read_complete() Message-ID: References: <20230717132602.2202147-1-zhangpeng362@huawei.com> <20230717132602.2202147-3-zhangpeng362@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717132602.2202147-3-zhangpeng362@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,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 On Mon, Jul 17, 2023 at 09:25:58PM +0800, Peng Zhang wrote: > +++ b/mm/page_io.c > @@ -406,19 +406,19 @@ static void sio_read_complete(struct kiocb *iocb, long ret) > > if (ret == sio->len) { > for (p = 0; p < sio->pages; p++) { > - struct page *page = sio->bvec[p].bv_page; > + struct folio *folio = page_folio(sio->bvec[p].bv_page); > > - SetPageUptodate(page); > - unlock_page(page); > + folio_mark_uptodate(folio); > + folio_unlock(folio); > } I'm kind of shocked this works today. Usually bvecs coalesce adjacent pages into a single entry, so you need to use a real iterator like bio_for_each_folio_all() to extract individual pages from a bvec. Maybe the sio bvec is constructed inefficiently. I think Kent had some bvec folio iterators in progress? > count_vm_events(PSWPIN, sio->pages); > } else { > for (p = 0; p < sio->pages; p++) { > - struct page *page = sio->bvec[p].bv_page; > + struct folio *folio = page_folio(sio->bvec[p].bv_page); > > - SetPageError(page); > - ClearPageUptodate(page); > - unlock_page(page); > + folio_set_error(folio); > + folio_clear_uptodate(folio); > + folio_unlock(folio); Similar questions to the last patch -- who checks the error flag on this page/folio, and isn't the folio already !uptodate? > } > pr_alert_ratelimited("Read-error on swap-device\n"); > } > -- > 2.25.1 >