From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 471873A4F35 for ; Thu, 30 Jul 2026 04:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785387510; cv=none; b=pE/I3pQgNT2HuE2fKUjkj++yP0CAPDbqSLq/ZA19s2cVAwDacrX6t0QNqPp5BSPmEh6+SDPSDPN6zgCi39G7nHuJsr7QfUkZxn0XYcFgSszmDASLNx5RGyfnQLo42ejI2aXxZuSFiGfqPyH1C7vMui3axxqee5GS81nEQSyjNok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785387510; c=relaxed/simple; bh=6EKgm8nuEG6R+AQ20jjnZXhzmrZkg1EifUJZW9092GI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nVudnNbdxsD+q53boi4MM3PWsrQCTxjnOoD+QkZmvLskggbfgq+T4Vb7f01fgHcv2hjJOymv57SXxHl0YYXp3D+Y2NdrYulFrW7+/XFeHSKsYRFOahbTd1b0/bXAMy1xStRa+zDQ0oGjghcYxJEr4/nAy2zr1YJD8O+ALW8R3rw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Zgr+uHwZ; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Zgr+uHwZ" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-51c4436d02cso8807331cf.1 for ; Wed, 29 Jul 2026 21:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1785387508; x=1785992308; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=xIFNfpu9gmD/EDvYhBb6eSwchsbOBYYW3f9ffk0DLHE=; b=Zgr+uHwZx+4ITvHiYBh9Qa8KDJP6qDAapn3BuVDzwPzLza0c/r4b0c/lF9NC++oCVX ag1bkpzDt4VsgWbF/T0ZDf2YBbAZlvuKuoAzqZ6fRXk+GqLtj0Jx9fql6DxqiyBquuo6 FuXF1KJpjGuJBcGLUiorZQflwv738+KY/vSH49lAGpusbofZLMUh9H2vRnolNXkrsYxO 0vKN2IRNALffXpg8lfx0tWowJ6XbB18l7cskv9GIrOAm9bAdVhGoZzVD/hAux4phZrfR gNx61MBFdGM2cSoFnsgFlVzcq9afpEUOYMGUzXcoOFTb2oPP3dKzGqJapQKdit/RPQCm m6Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785387508; x=1785992308; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=xIFNfpu9gmD/EDvYhBb6eSwchsbOBYYW3f9ffk0DLHE=; b=qM2QglayCTo/FsdutNbmdDldKdY77cYvR60bahtFiAfboBHpegenI5O0Mrnzj8IPZM xku032XZcWCGAqSvM5n8g0nUTSmEsmL0LO497x10y7WgOcjBi7zWHWzckP+C6Jcceagz lTYeDW7RmBcDFCvMXPEa9D0DI9crhUtXehVBRK0Ijv8naelGhRRCpyh2kuEmh/HHJDk6 1H60gO494HvALBTfUKGZWgtt2AuUF1fDYM1iy/1Cd87RBp+1wta9QP15hsqW3RumM5NU i5IR0oEBKSRTWgaKlzkjkV7d/kjOgKE72/S7zIlQRC7IZQUdAmCDTeFo8N/CpotYdglC oSGg== X-Forwarded-Encrypted: i=1; AHgh+RqOayuQnh6TpcXNOgaMPjvR7sjrOlRYK5dR4A8lWdKAPJLxiz+6hTbqPhdPkqgZi80uWNbftqHuHepflsQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywl9uPCD9/WzY6crAK0mYl3pSpc5mUJj0vCOpBAO2McVPCs/a3e uY5MAZ40MK2C4eMCO4k2A7OQw8o3uYOi4OzA+3YhOf8HMhs6KJlB0+w3XeEVSUI1lZ0= X-Gm-Gg: AR+sD10X/gZD88PRDHANHKFW8pi33g5jJESDf1wlhvDThZIUBEPfpnDKpgry/50Q5/w FFfUBgei6Zu2gM7pgEynw1nYVbixdKtpWoXaIxfcW6npG266PsX74Zn2lqBqd3i3ETcjHo5c+M3 fQeW78qpXV8Nh+vp20DVkUc8zoGn8T8zBS7uNTkatTkPelhPpuPSuuxbAI7viTdBTScSeaKAIEN n0DXpjaORX3mz2WGFjTWVIZJTmZxogbwhvUyWMCBNSK0YAPP+uou5EX31BRT5fdArj9UQTIr1xz CqmrJoJS+oubOV/OVlara9gufHM/oW7QBzqn6iNiMD4I4+N7kgF9N4T+2kCz1iyOQDDvq1aSKfE DQ8FfeIdpQQUEWt6vFA4B6Td1CA2vAr2MWrr30ngqDM+ZHEehmZt3EaUJKaOPjZPn61/qO6QIlr VMEkGCXB+yKNK5H1PKEiwgHoiHHbhg679tahqYXul09Yyu7sBKiLrQ5/TYWikU5zIfPG2nef1vt m2yuV+OwoovwM/sPh5p4Fe1Vt+4+eoG2HpDLmmI+PV5 X-Received: by 2002:ac8:59cf:0:b0:519:51b1:e764 with SMTP id d75a77b69052e-52b38662c5bmr13461711cf.47.1785387507988; Wed, 29 Jul 2026 21:58:27 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-933e733a27esm338204685a.34.2026.07.29.21.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 21:58:26 -0700 (PDT) Date: Thu, 30 Jul 2026 00:58:22 -0400 From: Gregory Price To: "Lorenzo Stoakes (ARM)" Cc: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , "Matthew Wilcox (Oracle)" , Jan Kara , Miaohe Lin , Naoya Horiguchi , Rik van Riel , Harry Yoo , Lance Yang , Kees Cook , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Usama Arif , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Peter Xu , Xu Xin , Chengming Zhou , Arnd Bergmann , Greg Kroah-Hartman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 03/15] mm: abstract vma_address() and introduce vma_anon_address() Message-ID: References: <20260729-b4-scalable-cow-virt-pgoff-v3-0-e8ecfefea812@kernel.org> <20260729-b4-scalable-cow-virt-pgoff-v3-3-e8ecfefea812@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260729-b4-scalable-cow-virt-pgoff-v3-3-e8ecfefea812@kernel.org> On Wed, Jul 29, 2026 at 05:48:38PM +0100, Lorenzo Stoakes (ARM) wrote: > > This will be necessary for determining the address of a folio's index > within a VMA when the folio belongs to a MAP_PRIVATE file-backed VMA but > has been CoW'd, and thus is anonymous, once the anonymous VMA page offset > field is used for the reverse mapping. > This is a doozy of a sentence... ... determines the address of a folio's index within a VMA when - the folio belongs to a MAP_PRIVATE file-backed VMA, but - has been cow'd - thus is anonymous (as well) - The original VMA may or may not also be marked anonymous? (just clarifying, could be original mapper or a COW that COWs) Ow, my brain. One question below > +static inline unsigned long vma_address(const struct vm_area_struct *vma, > + pgoff_t pgoff, unsigned long nr_pages) > +{ > + return __vma_address(vma, pgoff, vma_start_pgoff(vma), nr_pages); > +} > + ... snip ... > +static inline unsigned long vma_anon_address(const struct vm_area_struct *vma, > + pgoff_t pgoff_anon, unsigned long nr_pages) > +{ > + VM_WARN_ON_ONCE(!vma_is_anonymous(vma) && vma_test(vma, VMA_SHARED_BIT)); > + > + return __vma_address(vma, pgoff_anon, vma_start_anon_pgoff(vma), nr_pages); > +} > + Why make the caller have to know anon vs not-anon if you can determine from the vma bits which vma_start_pgoff variant to use? (I suppose this is probably the entire point of the series, just trying to get some clarity on the increased API surface). ~Gregory