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 CF90BC3601A for ; Mon, 7 Apr 2025 09:49:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55B406B0005; Mon, 7 Apr 2025 05:49:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50A0B6B0007; Mon, 7 Apr 2025 05:49:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D1DE6B0008; Mon, 7 Apr 2025 05:49:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1F70C6B0005 for ; Mon, 7 Apr 2025 05:49:27 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EFD41121205 for ; Mon, 7 Apr 2025 09:49:11 +0000 (UTC) X-FDA: 83306774502.16.699E7BB Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) by imf02.hostedemail.com (Postfix) with ESMTP id 11F4B80002 for ; Mon, 7 Apr 2025 09:49:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Ioe0kTZU; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf02.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744019350; a=rsa-sha256; cv=none; b=vDm6SNcllzTr7J7ILZnTTfNPZDBahdx4+2rmTKgwDMwVrMvfHvtiqoraHCUFg5E7XuiReW ji7DGePVeeJmN/UGko/ZJbgQk9R8R0puSpfwVSLCUK1JKTJ38KrVTzoEz9BAxLKqMZP29L tQy03oZxG5x0TLqWidnm6RakiUvah+s= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Ioe0kTZU; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf02.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.189 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=1744019350; 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=xY51UqUYs+eWoTOCBh+Jna/CIahu4dovjoMPFMGK+94=; b=o81h3KYqUL+lC6Z9G9ki/1T4ro62BUAvdw10sua2bzm/vT4xCsIZGXdcXAggXltlTj5szm IeHBiiCX2miANMs02NoNUwwsHXT3RRRxSabNWIOgBgoUJsECCSmytfcHedevIZKQK9cm6N /mMW/gHYrKOHL1PdqF3aYA/thgqd9ro= Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744019347; 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=xY51UqUYs+eWoTOCBh+Jna/CIahu4dovjoMPFMGK+94=; b=Ioe0kTZUDluJBwKyn71CrZez9rDEMB6zSMKpo+dmuXKcVyV5HkxteDiPlNtuTXAxXh/YCr +tbcirKNDPJAdHtNsPEF1atCVV+4DI5qhgzgJZ4zN4T0Zb/lhbjyS94pgHzTZEKgOPARLl daq/dx6lgL303v132nfYFpVxFTfuwUI= 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: <20250407085943.GA27481@lst.de> Date: Mon, 7 Apr 2025 17:48:27 +0800 Cc: Huan Yang , bingbu.cao@linux.intel.com, 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: 7bit Message-Id: <3DC6E604-3CE9-49E3-A688-DC7F424382DA@linux.dev> References: <20250327092922.536-1-link@vivo.com> <20250404090111.GB11105@lst.de> <9A899641-BDED-4773-B349-56AF1DD58B21@linux.dev> <43DD699A-5C5D-429B-A2B5-61FBEAE2E252@linux.dev> <6f76a497-248b-4f92-9448-755006c732c8@vivo.com> <35D26C00-952F-481C-8345-E339F0ED770B@linux.dev> <20250407085943.GA27481@lst.de> To: Christoph Hellwig X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 11F4B80002 X-Stat-Signature: hfsrmg7p791t9fninwp31ux5ojetg9b1 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1744019349-175314 X-HE-Meta: U2FsdGVkX18v5G5+dWuwNCy92td8RnGIQDuwKTcc4od93O6sczv1FMRY4gBqeQxzOGMJRXSJfg+sNfUyTmd6qU5jF8MrQOLtHlYQqIX9thhznCCSlENBRBAfOd+MXGSSXQiV4um73S7DKHRb6cMU5npx5WoNnR5KjYiKEyDjtFkpemL1HQr8UO71FGBG1EHk9A5HXuMRjYn9Zsf/WGxCG/XX7iFF+AnlGlQHLKuUkQkS4zD/QEKXclFqjokBEiCC0sS0352//5m10R/gYxChUUsr5je/A4krNDZ8TYaz1kl27jnMI/esvAtYaS7bguptyht3fN6C/JHgULHMbAVXRIrso8rZ4SS44+5Ppv66t7J+TApEjTZkzd/brVmz52qFGlENr1Sn+HM+N3qMFMZN9FZkeOZeA8BiZIP6jxhgYe1vfXe5QN6IpnJFYgwT/PjhzV9dWDA9pWy3jj1VJq6cBxI2gJ2P5rkGL1SwA9tU8EhAIk5/9pMqpp9VKqfJVsBQBMIUCD/4WAsZjUB1hUDiFUr+qzeUEbCS5RQ6yK9rEVxXTy8rnCmga3g7IiBR3njJievtblPcmSMlvACvdBkreTOOF9aavSySby/6lfCRBdQyfsQr6B1w3S+wL/nUqM1RzGlTkWAUeZKVDMeQeolWEJbLKP0wjefujA82/l37/uLsAqcQzUqiY8JZ0mZqliBuJq7eTERrnfVV3xB926Qco22O3s7saMRRbkomDH/zQ6intPrqgLvEbfLEAHSJaxODNfHU7BOTjSMqZKwD2ip5TpVmXSWeER5PGy5TBRy5/X5s4deZ39KiBD4gXpJFeecVmkD7xpNryrPBLQ4U96CwguvXxfC23fCu8p+xf1vFTOdPrAGxBW03kbSD1pVfZ+2ZorfpxQs4XpK4laDRTTVjgWavlx7FCudzGFhB++heDv3ZKP2wMp+yj0484PhUkUW/A+160P+FqNCVGoEvr6f Ie+TOu4P qpT7xUjJzIhoGj8aad8kn+dcqUyjOT3upExnyD+NotMvr+tgyUYhsIMSkUzp6wQjhdJfe9kyxCqDVBkcpqeuVaiNJrJwq+bL8cuxS5F8lyYljjQNWIIQDGuJg1b36bdcs/9bj7J/+HIaPKfIp/fSpXiSkPhlys2JPLHaCTafPb+o8lyhhL1SkKOprvdPxQHSGNO8oO/PetfI9+Ib8dCnZv9ZXezdRN7QmpJXTObf/0GHIvPsaq2uw3vkiuGevSXvwIJBp 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 7, 2025, at 16:59, Christoph Hellwig wrote: > > On Mon, Apr 07, 2025 at 02:43:20PM +0800, Muchun Song wrote: >> By the way, in case you truly struggle to comprehend the fundamental >> aspects of HVO, I would like to summarize for you the user-visible >> behaviors in comparison to the situation where HVO is disabled. >> >> HVO Status Tail Page Structures Head Page Structures >> Enabled Read-Only (RO) Read-Write (RW) >> Disabled Read-Write (RW) Read-Write (RW) >> >> The sole distinction between the two scenarios lies in whether the >> tail page structures are allowed to be written or not. Please refrain >> from getting bogged down in the details of the implementation of HVO. > > This feels extremely fragile to me. I doubt many people know what > operations needs read vs write access to tail pages. Or for higher > level operations if needs access to tail pages at all. > A compound page should modify its head page structure (e.g., refcount), which is why `compound_head()` is widely used. Modifying its tail page structures is incorrect. Users needn't worry about whether to modify tail page structures. They should use `compound_head(tail)` to get the head page structure and update it. All users must follow this rule (I think folio-infrastructure also requires this). If a user tries to write to a HugeTLB page's tail page, an exception will be raised as these tail pages are read-only mapped to catch invalid operations.