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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2D33C36010 for ; Fri, 4 Apr 2025 10:08:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E1136B000D; Fri, 4 Apr 2025 06:08:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08ED56B000E; Fri, 4 Apr 2025 06:08:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E70FC6B0010; Fri, 4 Apr 2025 06:08:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C92456B000D for ; Fri, 4 Apr 2025 06:08:41 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 906B01423FF for ; Fri, 4 Apr 2025 10:08:41 +0000 (UTC) X-FDA: 83295937242.22.89F48E4 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) by imf13.hostedemail.com (Postfix) with ESMTP id CDCE220011 for ; Fri, 4 Apr 2025 10:08:39 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=l55TQE1g; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of muchun.song@linux.dev designates 91.218.175.183 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743761320; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=H3vWWRH8W6vSZf9b1BUtRvjzptf2hYf7bVz0hYZoaVk=; b=Z3dnMTkljG2W3qNw6V33EhsosJHDJXKLjeXyeY0gBYFL3TTYVXeXfCTcvCA+TaTXHPHgGR vwkNK2wa0IBpo9Fuj7INdvLtgYPMZ/gAP8oVAZrQVXOkodvZTYDKfaHMqAwRXsOFzUAlvl U0SMWWPbWmKpzeUHWSHVSOenvivWEx8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743761320; a=rsa-sha256; cv=none; b=BhEEh0SJx+b3J4iyfv+eWgrKUpVheelL29Yuf11iV0APwZ4HUIfvIo4q0WBgaSMMPnynqw 35uy4olswZLqoyOzgS/QymjJq2uvX9wAsFSMGKS04XXzIWMX+xqgm28wPGjxzO1VKjKrG+ PECgOWHsxmGG3WOwgTY37/k9AefDOKo= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=l55TQE1g; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of muchun.song@linux.dev designates 91.218.175.183 as permitted sender) smtp.mailfrom=muchun.song@linux.dev Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1743761317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H3vWWRH8W6vSZf9b1BUtRvjzptf2hYf7bVz0hYZoaVk=; b=l55TQE1g/+e4KBgCOcGnu2XR1SFz6vXlDu9SB52QszYdsR2e9jqG5Puuvjqj6894HcRP7g AXC+6FHsyF38ePGmjeNrpYfvmhkC+Gr97PBm4ZQ2YcTxuop+qctK73VjuvsL1xsVpFVxo5 oWgIrkZXg5yN42z6egTF3GqXNsWU2B4= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP is broken, was Re: [RFC PATCH 0/6] Deep talk about folio vmap X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <9A899641-BDED-4773-B349-56AF1DD58B21@linux.dev> Date: Fri, 4 Apr 2025 18:07:50 +0800 Cc: bingbu.cao@linux.intel.com, Christoph Hellwig , Matthew Wilcox , Gerd Hoffmann , Vivek Kasireddy , Sumit Semwal , =?utf-8?Q?Christian_K=C3=B6nig?= , Andrew Morton , Uladzislau Rezki , Shuah Khan , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, opensource.kernel@vivo.com Content-Transfer-Encoding: quoted-printable Message-Id: <43DD699A-5C5D-429B-A2B5-61FBEAE2E252@linux.dev> References: <20250327092922.536-1-link@vivo.com> <20250404090111.GB11105@lst.de> <9A899641-BDED-4773-B349-56AF1DD58B21@linux.dev> To: Huan Yang X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CDCE220011 X-Stat-Signature: 9b7kp3b1u66dzzjp4xpje7ed4h6g5tox X-Rspam-User: X-HE-Tag: 1743761319-46171 X-HE-Meta: U2FsdGVkX19T5vRJMFDjMLiiFhcFv0mwv5o37Rb/i6HM93GXGgFH/nct1UbjNWLRNe4DaVTbTEIb07zu7JsvdC0vpjYv174UVWS1aludrdFGcTUJvyWH6rN0juO8KYz9j3t5oS06PH9v5suOZl6EkAPxZLbUC6ZZn84/MCo5VXhHamOvJMKekpiYG1/9bgv9UlLXXX3lx/8xJnVpMhDBwjyz+9bo2wo9fKxD5mrCHr2YfkGwgrXyxEwu5Gifw0ZiPJaQCoB3UR0ngRlNxFSLubKv5I8fOIPUWCPDLPdp7Tk8NTT4iCU9pRERBF2Wiz4qZFUGEap0zzaGKJm0a2r8r+li0pKvVDfwjSezRusbj+sPN8jR8rqvdpuN3l+ApLuKMu7bT0LoF115WhbT50CU3GNFFQJoSc1M21slRSm4g5SfPqEJ51w7KYjGdybhdhOOsD1ZPD5hzdUhq6tPrrjkn+GaX8ev8WYJz/h8W/9OsPtH71039u0eM7CW4f2CtiRXcZdnAFSYVx7CqjnjJFwMJhOQWAOmilok89sK3ZALwJehjiq6HY7oYNXVrv9mxLBUKYoL33XwwEYjQTb6UdHtc7abMHpOKUniTz0zWyAE1dO1hZkOlboY+2M9QrJ/FSJiWO+HE9Mr67Ky7tr07pZ/JGJioNt2cmQ2wFYjIumERK9m2p1RhV81n+w/4/pvH298foeyJ94JqeeSzzZMt8Ulg51gpqx/MT/6wwZ0qSgH8VBXWMuRERA0somNLbBnwHZl6/8CR22gc/UmJYl+Hs3TXYrzhijvpBZJMB+n4BZKDgI524AvNWuyl81hECLXyqwdUGFbAEFIwXDe5hCTASrtC6xo+XR01fGzAIA5SLUILXto64SMhMwfLnn4iKeA46w0gIOM2LGWJeBr6/54AZ5ceEWcLe3bxPjdtDOXSXwb6XifYkgY2PzEiE1GNe6O6JyeD5ZFOI95o6V0C5Da8V9 orYx26a9 0YxALjHu9veMBEk8uuwjo368y4D47YV6RZMJIYo2HGJ3II1Vtlk4HVMAWW1WKck+iksi2yP3chl+Yty5lszvtKk4NlhQGFETfJLz/MABeY4isw+NE/GxHMVGsYP9TVx3XhG62fF19nmbgUZGQdbqbkATUyl48bTee7pgF1I1UvrM1IgWAXL23eXWqB5z2qwH6gLdXIJuIedhMB44J41VyBhsX5NfxPX3lCnW+FVN4I4/N5droB3boaIfOwb7LCQ2fWtUGDFlMKy/E2w8Wxyan8KyXb1ni+sC0tY11HXlRpOWAGqpZxCO1My2dVQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: > On Apr 4, 2025, at 17:38, Muchun Song wrote: >=20 >=20 >=20 >> On Apr 4, 2025, at 17:01, Christoph Hellwig wrote: >>=20 >> After the btrfs compressed bio discussion I think the hugetlb changes = that >> skip the tail pages are fundamentally unsafe in the current kernel. >>=20 >> That is because the bio_vec representation assumes tail pages do = exist, so >> as soon as you are doing direct I/O that generates a bvec starting = beyond >> the present head page things will blow up. Other users of bio_vecs = might >> do the same, but the way the block bio_vecs are generated are very = suspect >> to that. So we'll first need to sort that out and a few other things >> before we can even think of enabling such a feature. >>=20 >=20 > I would like to express my gratitude to Christoph for including me in = the > thread. I have carefully read the cover letter in [1], which indicates > that an issue has arisen due to the improper use of `vmap_pfn()`. I'm > wondering if we could consider using `vmap()` instead. In the HVO = scenario, > the tail struct pages do **exist**, but they are read-only. I've = examined > the code of `vmap()`, and it appears that it only reads the struct = page. > Therefore, it seems feasible for us to use `vmap()` (I am not a expert = in > udmabuf.). Right? I believe my stance is correct. I've also reviewed another thread in = [2]. Allow me to clarify and correct the viewpoints you presented. You = stated: " So by HVO, it also not backed by pages, only contains folio head, = each tail pfn's page struct go away. " This statement is entirely inaccurate. The tail pages do not cease to = exist; rather, they are read-only. For your specific use-case, please use = `vmap()` to resolve the issue at hand. If you wish to gain a comprehensive = understanding of the fundamentals of HVO, I kindly suggest a thorough review of the = document in [3]. [2] = https://lore.kernel.org/lkml/5229b24f-1984-4225-ae03-8b952de56e3b@vivo.com= /#t [3] Documentation/mm/vmemmap_dedup.rst >=20 > [1] = https://lore.kernel.org/linux-mm/20250327092922.536-1-link@vivo.com/T/#m05= 5b34978cf882fd44d2d08d929b50292d8502b4 >=20 > Thanks, > Muchun. >=20