From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 B85413B19D5 for ; Thu, 30 Jul 2026 06:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785392928; cv=none; b=CI3JFJvpckP5FoKj3KDNGlhmPbQ8L9w3q+uu8y6QOMZDJhcdmQpRZPTmIWmHf0sbRBdWn1evDBO2nIc/D2vFoE5zaF5oVX550n/V8ps7KLgx7Y3INYFg+a9r51XIngYxoYzg/NYiJh3VsMObv3WVFyArve2Wrlx91FtxcZkL8MA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785392928; c=relaxed/simple; bh=On1K3w81fo3KsHiluy85FHhsNbZ3rFpNf8XA/wTGIuc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MrpCn2HVwBwLLlSMRMz65bvzenFyGMuSizXKJsJhqL7zYq0PeOxY+/zaAKUQ7KsN9RwNpD1N1ozbo16gJDqttJDwPbiv++migajZt8qktv+CpfeDISEFZVPB/WW4fVyy9prU4PP7Ut4LWUmP3VNBzaFytNrlZX0KsXSBEGOjsIg= 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=Xoinvwuy; arc=none smtp.client-ip=209.85.222.174 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="Xoinvwuy" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-92e5b048375so95869785a.1 for ; Wed, 29 Jul 2026 23:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1785392920; x=1785997720; 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=BYuSkRMlAL8RFmXTAhfpgmHH3OtvbWBlkpFHBuC4V6M=; b=XoinvwuyyCqJJMjYeE7YopI2LKZonCNERKJgEn5p0j1kOL5jpSypAzwv9MmO6uHx6+ VE3FKIFrwlodVOQ5QkuhSzQJA82N4rVG1aEX71DT5fbmQ0TVhNxDUTqG6DP2YyvgRJzA Y8X3c7nCuBtToSOOkmMYJi3gtWBTdH8FsfZzNRc6flOFGmkn32LibInyTiy/FDCxevVV dx9ySgcg5a8jmJvLo+tl+CGNDf2hkhxPPmSdW0bDnHEOKwykZAJCMWXQA8YBxPWlsM4U A/wUkTk5Gh1c8Cp80l2UbEMGG8vGG5IljZyjR7piGMOBrMLgOba/fTeb0QKwn5ex2wge kWXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785392920; x=1785997720; 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=BYuSkRMlAL8RFmXTAhfpgmHH3OtvbWBlkpFHBuC4V6M=; b=KdjE/qS88ETe1xezrox11Yp+9JrHRoHL0B2M2fM9rU2g8vOYLy2MjzvrrjhVKS85g1 3Mlz5ma2LGYClaIJ16SxgkuqkYNRTbbvui7XMzpzjXcmH09CZJgOSUHk6L/HDvp1nT26 0ZAQ6Of3v13cU+Zoh06ejCq/KFo/sX3+cR4v1WbzzDvCmTrEgej7zqvTMWbUgcOLcInT RDr9HgrfFr3sHZrrWbMN2QhydqZfycjQaYWFcOrqb2H2NNHZ3EOu94Pd9CamAjJV+m9J QM06wxrf0B99nLMK5/wNfXM63A2HvEIe/lOPGGi6Rc43tAB2QxHke6z6z3YeQoPhRttn sI+A== X-Forwarded-Encrypted: i=1; AHgh+Rrv7BA7dBx9cMqizmkdYbbtzVoOqC/eHyWCn+CO5B+blGDfc+UveOfQNe+HgKT4khwnU3rFzpXonGDPiog=@vger.kernel.org X-Gm-Message-State: AOJu0YznZMpA2DsnkaLHJLSIOjmGI+FzrjGYFaLfwA6BmKhziaZrylhr gg/021UY0krR80H+lRgtF3t7zHQDXm5ccLUMAhuBufXINCOPXiZfZOH2lnA69XipDbA= X-Gm-Gg: AR+sD12bj478xSeQHeRn9Yz4nXsZAeaQblBcAWA0SRpd0e5kMcva5yluMmEXcR9QVHw 1wmyV/x83q8zWZE4AMXotYG4D9pI+V2rfoCTns29SRNzxLP52f2DjtCMhnv1cgObChMJSF05GAG Svl+EFQDBULhZjrtad5fqshDcVC+jc5vFxSi6A+bKqjJxWY5BXnrcVpHZuglQJGuXw1tV3QYU7c ozDH6aWBD0qgfh0czhRwX6nCDoOq/71sPWDbqhoS3vUr5NKT62GgXRAp/BlfvDf0fk0/xlf5ZDz vBnEIHDdJzbyx7JVkyCDkuWUOVjY+IR1fpRVIMLywydkzILpRe5Kcvg+0AjyfR6/SUQPhC1WmV0 OhsoG+R5uxD/son/6rPaUBVEP8+vg4gOJHRfKxGJi11GQdhxmCLkKGdFiKesmfYWw2FRKYe1KUA pTTlkttMX5TIxaVvbsCtq3TPH1UOUVtAkjv089UoZVSXjAZ3AG2Xl4aSoQim2b4IDpeukN0d2Sq ljh6EYOb5WPOa8z+LfP6Hi3/nF6nrpRhvfgeVaTffo0l2j2SmpUKiQ= X-Received: by 2002:a05:620a:252:b0:92e:fe10:3f02 with SMTP id af79cd13be357-9348613d64dmr94585385a.51.1785392919868; Wed, 29 Jul 2026 23:28:39 -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-933e7318180sm346275085a.28.2026.07.29.23.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 23:28:37 -0700 (PDT) Date: Thu, 30 Jul 2026 02:28:35 -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 02/15] mm: introduce linear_anon_page_index() Message-ID: References: <20260729-b4-scalable-cow-virt-pgoff-v3-0-e8ecfefea812@kernel.org> <20260729-b4-scalable-cow-virt-pgoff-v3-2-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-2-e8ecfefea812@kernel.org> On Wed, Jul 29, 2026 at 05:48:37PM +0100, Lorenzo Stoakes (ARM) wrote: > This function provides the anonymous equivalent of linear_page_index(), > instead offsetting based on the anonymous page offset of the VMA. > > It is valid only for anonymous or MAP_PRIVATE file-backed mappings. It must > not be called for shared file-backed mappings. > > For pure anon VMAs, this will be equal to linear_page_index(). > > Assert that both of these invariants are true In linear_anon_page_index() > and implement the algorithm in __linear_anon_page_index(). > > Note that MAP_PRIVATE-/dev/zero mappings will satisfy vma_is_anonymous() > but not fulfill this invariant, so when asserting this we check > vma->vm_file to account for this. > > We do not update callsites yet, so no functional change intended. > > Also const-ify vma_is_anonymous() to make it compatible with the > const-ified linear_anon_page_index(). > > VMA userland tests are also updated accordingly. > > Signed-off-by: Lorenzo Stoakes (ARM) Reviewed-by: Gregory Price (Meta)