Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9112083rwp; Wed, 19 Jul 2023 23:00:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlH1/umLrNIw4Xf9pKVlXiwLiXre8zaahVpfHk0Lwf4RxjwkhUFjPiRCPgDgzDSznHiCraY3 X-Received: by 2002:a05:6a21:6d92:b0:134:e14c:851b with SMTP id wl18-20020a056a216d9200b00134e14c851bmr5064209pzb.23.1689832844044; Wed, 19 Jul 2023 23:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689832844; cv=none; d=google.com; s=arc-20160816; b=x+ggjWSzUcZkQa2s4GWuXRhJBjZmOdKTF0NNZZMIwyox5GO3pNfM+pZ4NgdvrRJ+/8 RfiUHZpbH1hxECXDSCpHN9NZ72AXv09Lt5UfYCevu6TGPXA/ShC9/Emj8tFbkUG5mEqP +QWboD8GL/b/pkKExqjo0fx31LVaynmWwIckejcCBjf95/Q26QiLYyjqtsv1ljo3elR+ qPG1ir31jgaMbe9FweIxxF23vmy7A/GTn57WiZ1a/J6727mqkp4wtl7mu1TmKRnp3G3d 8kSiztYPaytsCXfW4fFA+pDsR7R6/0r5DBu1YmLFOpuNf1/LkTFOrHtvVoN59197oOU2 uIjw== 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=CDKYREQdRXyTlFXvhiTxHWPhw/v5r8WPhz7dV9fWKqU=; fh=vWf3Es29UJqAMZ0VB+lwjS6rh/+a4lqZ8P9szkjCQkg=; b=Blg/53XIcHVh/lYZAZcOtUHBlXqoVwTUkYRjeCZ1LdYcidsIAiNNn2j2gZfFVOu9UK W8Oxfc8+3WUTpDH75Js6MQXT6LrjXy8D43UEYskKc1ODAe75pXgvWEl5gxq+Hd9oLp/3 IqRpm6kB+cTIkH2KfhgLOa/EFJiD6zg7Pg7P5zKNsRSF2RpCAvoCvGbV6iDsemdeoKSN iu+Mr05lZcokjlqPaPSrGMT0Swcm5c4i6oSY9mDZUd8Aa8p9TgAyjoJLBIoIkqLGq/Q4 Hz1wGzL0zMu7JqiTlp5lc2QN6/b5e1+8jbRmsIbsBk7iFg3cyZ5f28U2URpThh/VM2Qc Yo/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=tYgOcUvN; 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 q15-20020a056a00150f00b0067d12984ec5si257212pfu.289.2023.07.19.23.00.30; Wed, 19 Jul 2023 23:00:44 -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=bombadil.20210309 header.b=tYgOcUvN; 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 S229736AbjGTFWj (ORCPT + 99 others); Thu, 20 Jul 2023 01:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjGTFWh (ORCPT ); Thu, 20 Jul 2023 01:22:37 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322B1110 for ; Wed, 19 Jul 2023 22:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=CDKYREQdRXyTlFXvhiTxHWPhw/v5r8WPhz7dV9fWKqU=; b=tYgOcUvNE6Cg4zr2JuXcJPczFB DXC6CUKnyFJOBQqHeqQAoN9bj3gxTr5+AmnZ4hxKsr0pmF2lACUlK2M+NNP87bo3wnJL/DdXoIzzQ gxj5v0eWICQYh1S1fksK4QIh50kNiKsq/HyxQmqjU9ewjR4V4nof6B/iuCKLtD/fGq+gZyAHheox9 JAV+ubv2L22CiXGk0iGyG8V2mVlLuSmkGJQifQSDHa2NEhb2lxtHn9zb52hlxiEbJtb1J4o1oYogK H9HumonrZHn7d9qmnaVYMi7pLSHJZn4LDVUmhZFsnbzUm7YpXm843JRMa/WfTYCca84Ddj6099c2o uxE0+aHQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qMM7V-009p1m-31; Thu, 20 Jul 2023 05:22:33 +0000 Date: Wed, 19 Jul 2023 22:22:33 -0700 From: Christoph Hellwig To: Matthew Wilcox Cc: Peng Zhang , 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: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 02:40:24PM +0100, Matthew Wilcox wrote: > > 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. sio_read_complete is a kiocb.ki_complete handler. There is no coalesce going on for ITER_BVEC iov_iters, which share nothing but the underlying data structure with the block I/O path.