Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1198455pxb; Mon, 11 Oct 2021 00:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytL73XCp5hVJJimK+SSz0fxKFFV/oAO1F14Ix0ZrZ4A1h19SuJ/HTB52aV5XTe9b18/xys X-Received: by 2002:a50:da0a:: with SMTP id z10mr37339615edj.298.1633935891707; Mon, 11 Oct 2021 00:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633935891; cv=none; d=google.com; s=arc-20160816; b=UtmfHRIFvl2S/VkssOUuqbLQR71TKASORka3c+CcTe+8K22zyhVy7kIBjwI0NUsDaX 0rklPB67sooVEu6v5rTzZ74P7WWZTN4VFVSbBzh1waNuuCXWftEqnUtf6NcnydV+xmvN LGyqJtm3jNQoN15BtvtfhSB3AxekMW5cZTZVord0o97+RvrEO2HoLFPEllzkWMQQsVOk cbYeIwWtdAu8JcRYpH16GfG3aH4Plb5/u8nymboSoCgsytn44d5Efn12hfa0YQZh2jDg yMw8Rv/WNAcIkd0uCsTyJjrCaOni8dg+Vw9DRtQkIFFTuDPUM5b9BL0PXkTWHbpYgd4D y1Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=1A+ZHPqZnksqHGy65gg8O2UqaaGpOJUfSZsXLlgG2CA=; b=IZLwvcW4zECxiBfyHuW1ylemYVM9EfxCZ2X3jZYou5Frh2krgWg6MQOJ7BhKLh3fug msHGClypGYO+YCnWj2TSApKWejZVJEvTIC/hkLtd3sjSX47LCwv5AL65crPeMsyYMZL4 8Wama7whwPK+HwdskcaTwxZtWc04sLImb6qVk4GgzEG647Nb/JtgnplQzyEJ3Lp6fE6Y rZKqKt4IMrEVoKDMODPzJRgKNs4n8DQOHn8F/j1/k06TqVpeFaTWjZTPluztjZc/zXg5 xlL1PSJzEY6B4iB7o2/KFkzyy2499wZPGPI/T8iydrlWDcLquzcmksvrWAxuoln8rJ8+ p6qA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z29si11258315edl.65.2021.10.11.00.04.28; Mon, 11 Oct 2021 00:04:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234224AbhJKGje (ORCPT + 99 others); Mon, 11 Oct 2021 02:39:34 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:25117 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233522AbhJKGj3 (ORCPT ); Mon, 11 Oct 2021 02:39:29 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4HSTZb0c8fz1DHJ1; Mon, 11 Oct 2021 14:35:51 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 11 Oct 2021 14:37:25 +0800 Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Mon, 11 Oct 2021 14:37:25 +0800 Subject: Re: [PATCH net-next -v5 3/4] mm: introduce __get_page() and __put_page() To: Matthew Wilcox , John Hubbard CC: , , , , , , , , , , , , , , , , , , , , , , , , References: <20211009093724.10539-1-linyunsheng@huawei.com> <20211009093724.10539-4-linyunsheng@huawei.com> <62106771-7d2a-3897-c318-79578360a88a@nvidia.com> From: Yunsheng Lin Message-ID: <6a072675-89e9-5635-5a9f-08aaf2e5364f@huawei.com> Date: Mon, 11 Oct 2021 14:37:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme720-chm.china.huawei.com (10.1.199.116) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/10/10 4:15, Matthew Wilcox wrote: > On Sat, Oct 09, 2021 at 12:49:29PM -0700, John Hubbard wrote: >> On 10/9/21 02:37, Yunsheng Lin wrote: >>> Introduce __get_page() and __put_page() to operate on the >>> base page or head of a compound page for the cases when a >>> page is known to be a base page or head of a compound page. >> >> Hi, >> >> I wonder if you are aware of a much larger, 137-patch seriesto do that: >> folio/pageset [1]? >> >> The naming you are proposing here does not really improve clarity. There >> is nothing about __get_page() that makes it clear that it's meant only >> for head/base pages, while get_page() tail pages as well. And the >> well-known and widely used get_page() and put_page() get their meaning >> shifted. >> >> This area is hard to get right, and that's why there have been 15 >> versions, and a lot of contention associated with [1]. If you have an >> alternate approach, I think it would be better in its own separate >> series, with a cover letter that, at a minimum, explains how it compares >> to folios/pagesets. As I was not familiar enough with mm, so I tried the semantic of __page_frag_cache_drain(), which expects a base page or the head page of a compound page too. I suppose we may need to put a BUG_ON() to catch the case of user passing a tail page accidentally, which is a run time error and has run time overhead? And adding a new type like folio will allow the compiler to catch the error without any overhead? > > I wasn't initially sure whether network pagepools should be part of > struct folio or should be their own separate type. At this point, I Actually only a few driver are using page pool now, and others are mostly using page allocator directly, see page_frag_alloc_align() and skb_page_frag_refill(), only changing the page pool does not seems helpful here, maybe the whole network stack should be using a new type like folio, as the netstask does not need to deal with tail page directly? And it seems virt_to_page() is one of the things need handling when netstack is changed to use a new type like folio? >