Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp321143lqp; Thu, 21 Mar 2024 02:08:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfZ+lMxbQic/lx2OhvG5Nte5ddhd7kFLFDGwtYnNLR/4x67/FIt01H0OPmIAxDw1Hg5YhK1ePYH/R02NIUtbMAfpdvq3J5GDPUYfStmA== X-Google-Smtp-Source: AGHT+IEaLTxM6OhKohf4jdc3U46cYiMcde5vE8yuQiOfO9+uFQdWyvGrvWtibudUirj+vH6UCyM1 X-Received: by 2002:a05:620a:5201:b0:789:f507:2039 with SMTP id dc1-20020a05620a520100b00789f5072039mr8151321qkb.29.1711012098781; Thu, 21 Mar 2024 02:08:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711012098; cv=pass; d=google.com; s=arc-20160816; b=Wf8PXFT+tRyHipMiy6ZxaN2/GOI2ZLGZNccaRfrfjIZ2eqfTr/mFdL64hJC2G6lQ+6 yxmXyF1G7krwRzuPkFxA2fsc+F7bci7YN3zBRGY8j1GkQzCPcDggUp9+xisjQi1OUBhu KlU6EFGW36SGNqNcRTngK4YfDBKyhE86fzCE0Wr70RJ/TckyQRF5VkdLigN2gl8QWqL4 IBgbtj7I2drVrhJ85vZlU6Igd/Y0f6QJGy2gGAVFnaeqkyTZOxErKTQM5410Wv+vHCYn xfENTVTzN+qt5DeUvwX5OAgaYNxIdo42ZVXAPAExomPDcnJ44FQqiib2YIRSRRWNMMKF 04bA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=rlK8YMV5X6UOVcMuLw9wMWm9TNkeooeAHZC3y/EUm3E=; fh=OOxAYdWZ82JGuLWazM++kXAOlc0xHKIO8afMfdQVFuk=; b=YQdKFT6wfWJVJLmf6vyOJCfxZe8R85DNd2IXscs84B+0PC8/BZ6GWAOyCiLISirZOb l/kENLsk3l4UTU33G9rAAFxvUZquAsqsVjl8ka9JbulxbLFws76r1uf1uU0GQ1x6mhJY WEzWP1MLwfcE8mtpy3uE9KcWqeA/uUZclAGJ5PsB0wjewK0IXx7OE2FhOWqneebU46Cm nx6KDk1spY9CHDIzNgkOaFYEmv4ryVMKlu2LZoM3SqZN8vE91pRsukD7BwOpJDd6w72s FbOn1yi8U/RlHEvK1GdYckh1UY31ky6QLAKfuDhnVCTy9+LCvwoqEW92+L4fkO6wVRzC wXLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-109830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109830-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bn12-20020a05620a2acc00b00789f3687370si10027211qkb.574.2024.03.21.02.08.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 02:08:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-109830-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109830-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 749241C20DEF for ; Thu, 21 Mar 2024 09:08:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3E8A3BBFA; Thu, 21 Mar 2024 09:08:10 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83669BE47; Thu, 21 Mar 2024 09:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711012090; cv=none; b=ikEezFnWezKUyGK722y7GdEVmbacNftzutGDl9a+lmuyXhdpAMX92PyPEifMWTCFmUN0+NKtVjROaW9d7A9ovDIx6BxRiUE++0zO1mC3oVKJaMOO93lq6U75pXwMVOzT3q1dwwKLfug2eFb6HLrbOmv7mU5ahItI41oXfcJoLfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711012090; c=relaxed/simple; bh=Qpcx0mFyj0lNkiDCl/naVg0tO54qntAJp1uhqBMPplg=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=bhrANU3MMLoOHas+yD0RjmvbFNComuyO2Zuoaw8fkwPr2iqBfDfdJ3/UefH5jvCtDuVqNozOXZIW90VIbkhU3J6OJk1Jm27QqJZHLL8cnTetiScUAfDBvrwbjM6pn8Wwxw+xH74wqGssuthdCSz87yO+Zh2Paz1vmBFbHH1CZ3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4V0fgV0SgqzwPtl; Thu, 21 Mar 2024 17:05:26 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id BC47E140114; Thu, 21 Mar 2024 17:07:59 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 21 Mar 2024 17:07:59 +0800 Message-ID: <45a2ab40-bc03-417e-9b9a-bb140e5f3444@huawei.com> Date: Thu, 21 Mar 2024 17:07:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] fs: aio: use a folio in aio_setup_ring() Content-Language: en-US To: Alexander Viro , Benjamin LaHaise , Christian Brauner , Jan Kara , , Matthew Wilcox CC: , References: <20240321082733.614329-1-wangkefeng.wang@huawei.com> <20240321082733.614329-2-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: <20240321082733.614329-2-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) On 2024/3/21 16:27, Kefeng Wang wrote: > Use a folio throughout aio_setup_ring() to remove calls to compound_head(). > > Signed-off-by: Kefeng Wang > --- > fs/aio.c | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > > diff --git a/fs/aio.c b/fs/aio.c > index 9cdaa2faa536..d7f6c8705016 100644 > --- a/fs/aio.c > +++ b/fs/aio.c > @@ -527,17 +527,20 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) > } > > for (i = 0; i < nr_pages; i++) { > - struct page *page; > - page = find_or_create_page(file->f_mapping, > - i, GFP_USER | __GFP_ZERO); > - if (!page) > + struct folio *folio; > + > + folio = __filemap_get_folio(file->f_mapping, i, > + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, > + GFP_USER | __GFP_ZERO); > + if (!folio) Oh, this should be if (IS_ERR(folio)), will update. > break; > - pr_debug("pid(%d) page[%d]->count=%d\n", > - current->pid, i, page_count(page)); > - SetPageUptodate(page); > - unlock_page(page); > > - ctx->ring_pages[i] = page; > + pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i, > + folio_ref_count(folio)); > + folio_mark_uptodate(folio); > + folio_unlock(folio); > + > + ctx->ring_pages[i] = &folio->page; > } > ctx->nr_pages = i; >