From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F31E135836E for ; Thu, 2 Jul 2026 22:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783029831; cv=none; b=TO6B5s1qqXBry34eoaglb60VMqBp66nFgTQFRKaRwz0lnqckgX09U/MANJ3ZhcguS0Dnx5SwdAFLBuuI2leSLoPLWCD2fJ2wNArFvUf31XiXRxTkXriiNQOAcrKPIT6GpUg8UbL+pdcw5tQRdE3ZWyc6pn33fOErmjBpnKGBvMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783029831; c=relaxed/simple; bh=1XSMJ+l+wEQVDYOVmMS3cqbyDBYJ+pZcTIDrizFW2rU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=j45LQfsZbxzEmMUI046VHM06qdx/CwsRdUD2RSesjKUEw7zCMRKR0HEDEvQxP+Vq/ssDd3JSxbQ6H/0eOIbCUx8kKsRAFnZ3zWaZ4JSQWdmz6Q0FimMJEfert+m88DIjxI5LENPgZXEoKUkEEWC+b7dUtXaNIK7seCo/4au+PEo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=LCvUZwNn; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="LCvUZwNn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BEE41F000E9; Thu, 2 Jul 2026 22:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783029830; bh=7gpeX2+OCbIxc12i2mYZPsdcMfJTSqmx3ZrRkkdCM+4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=LCvUZwNnVrM2HNgsSPkoUmu830cGdvN7ppa4NBCYDDqZ/QdSrKlIm2Q5Hx3LKfZ7T 84W0oQPg+pqDk9ZTIzx0YN+n8abBhwe5AStbXHu54vtFuicY3XpNwqNEN1mCycx/D4 xKshI9yvWQg+6sD1VsWKkpX5wEn4Z+KtYLvuVJp0= Date: Thu, 2 Jul 2026 15:03:49 -0700 From: Andrew Morton To: ackerleytng@google.com Cc: Ackerley Tng via B4 Relay , Muchun Song , Oscar Salvador , David Hildenbrand , fvdl@google.com, jiaqiyan@google.com, joshua.hahnjy@gmail.com, jthoughton@google.com, mhocko@kernel.org, michael.roth@amd.com, pasha.tatashin@soleen.com, pbonzini@redhat.com, peterx@redhat.com, pratyush@kernel.org, rick.p.edgecombe@intel.com, rientjes@google.com, roman.gushchin@linux.dev, seanjc@google.com, shakeel.butt@linux.dev, shivankg@amd.com, vannapurve@google.com, yan.y.zhao@intel.com, Zi Yan , Matthew Brost , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Dan Williams , Jason Gunthorpe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 5/6] mm: hugetlb: Move mem_cgroup_charge_hugetlb() earlier in allocation Message-Id: <20260702150349.1aa99d5a0ecca8fecc07ffdf@linux-foundation.org> In-Reply-To: <20260702-hugetlb-open-up-v4-5-d53cefcccf34@google.com> References: <20260702-hugetlb-open-up-v4-0-d53cefcccf34@google.com> <20260702-hugetlb-open-up-v4-5-d53cefcccf34@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 02 Jul 2026 09:21:49 -0700 Ackerley Tng via B4 Relay wrote: > Move mem_cgroup_charge_hugetlb() earlier in the folio allocation > process. This change draws a cleaner line between memcg charging and the > subsequent hugetlb-specific reservation logic for VMAs and subpools. > > While it would be ideal to make all accounting and reservations perfectly > symmetric, mem_cgroup_charge_hugetlb() is a complex operation that cannot > be performed under the hugetlb_lock. Moving the charge to this earlier > point ensures that memcg charging is handled before the code begins > manipulating subpool and VMA-specific state. These two types of accounting > will be separated in a future patch. > > If mem_cgroup_charge_hugetlb() fails, the code now branches to > out_subpool_put to ensure the folio is freed and the subpool references are > handled correctly. Is this patch also "No functional change intended"?