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 A5CA9C7EE24 for ; Mon, 5 Jun 2023 11:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231643AbjFELPL (ORCPT ); Mon, 5 Jun 2023 07:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjFELPH (ORCPT ); Mon, 5 Jun 2023 07:15:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D96B8 for ; Mon, 5 Jun 2023 04:15:05 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QZWCQ2KbgzLqTy; Mon, 5 Jun 2023 19:12:02 +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.23; Mon, 5 Jun 2023 19:15:02 +0800 Message-ID: <188bd60a-e58a-a0f7-727f-bb2ce2a40d94@huawei.com> Date: Mon, 5 Jun 2023 19:15:02 +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/2] mm/hugetlb: Use a folio in hugetlb_wp() Content-Language: en-US To: Matthew Wilcox CC: , , , , , , , , References: <20230602015408.376149-1-zhangpeng362@huawei.com> <20230602015408.376149-3-zhangpeng362@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: dggems704-chm.china.huawei.com (10.3.19.181) 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/6/3 4:17, Matthew Wilcox wrote: > On Fri, Jun 02, 2023 at 09:54:08AM +0800, Peng Zhang wrote: >> From: ZhangPeng >> >> We can replace nine implict calls to compound_head() with one by using >> old_folio. However, we still need to keep old_page because we need to >> know which page in the folio we are copying. > Do we? It's my understanding (and I am far from an expert here ...) > that the 'pte_t *' we are passed *inside hugetlbfs* is not in fact a pte > pointer at all but actually a pmd or pud pointer. See how we do this: > > pte_t pte = huge_ptep_get(ptep); > > and so the page we get back is always a head page, and we can go > directly to a folio. ie this is different from the THP cases. Yes, I'll remove ptepage and old_page in a v2. Thanks. Best Regards, Peng