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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86901C001B0 for ; Wed, 19 Jul 2023 07:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbjGSHrm (ORCPT ); Wed, 19 Jul 2023 03:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjGSHr1 (ORCPT ); Wed, 19 Jul 2023 03:47:27 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3971FFB for ; Wed, 19 Jul 2023 00:47:23 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5SX56LkJzLnsh; Wed, 19 Jul 2023 15:44:53 +0800 (CST) Received: from [10.174.179.160] (10.174.179.160) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 19 Jul 2023 15:47:20 +0800 Message-ID: <526ccc57-a1c3-455a-3f4a-34cd5c517bc7@huawei.com> Date: Wed, 19 Jul 2023 15:47:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 2/6] mm/page_io: use a folio in sio_read_complete() Content-Language: en-US To: Matthew Wilcox CC: , , , , , , Kent Overstreet References: <20230717132602.2202147-1-zhangpeng362@huawei.com> <20230717132602.2202147-3-zhangpeng362@huawei.com> <48a73879-6d25-4350-a8cb-8cee58878b1c@huawei.com> From: "zhangpeng (AS)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.160] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/19 0:21, Matthew Wilcox wrote: > On Tue, Jul 18, 2023 at 08:58:17PM +0800, zhangpeng (AS) wrote: >> On 2023/7/17 21:40, Matthew Wilcox wrote: >> >>> 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? >> I'll convert bio_first_page_all() to bio_first_folio_all() in a v2. > That isn't my point at all. What I'm saying is that when you call a > function like bio_add_folio(), if @folio is physically adjacent to the > immediately prior folio already in the bio, it will extend the bv_len > instead of adding the new folio to the bvec. Maybe there's nothing like > that for sio. Thanks for your reply! I got it. -- Best Regards, Peng