From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 7B20E423A85 for ; Mon, 11 May 2026 16:39:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778517564; cv=none; b=Cyp2jbpL/ceRxTWBzGKa0pXRkMF4bA/6H8qJbNe30Y6XTbrLEeojH1HVvoaaE8ibQdX1sldrM9ij9YNw+w6jJTdbCot4TwzGsliiwoP0YCw9hkL5N3KYLXYB2+3ADFVjPsXVU/K2WW/vT+ivEN5miqV/mfXok5gyyWZY0S8BzME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778517564; c=relaxed/simple; bh=4Z/pGmsFR+R5jgi7XomTCcdweLDmhQVgfxAEbIcOHWE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hFjbAP/1O3UYUciH4dRsgbbGWcl0N9WARxRUJo2Faw+RoBEzhY/W4bKWbn/f+5I2VFd/Y2ub1r81SlWUf0NSVZp/6bWoHGj18/U02qhLZFMCMs0QJtelxvkwIFJDy0q7XvOO9CdGqEkMGYcOlJuQZXL4v1IZ4/gnB6CiELMOXT0= 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=TlB60STR; arc=none smtp.client-ip=209.85.222.176 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="TlB60STR" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-902deb2412fso488630785a.3 for ; Mon, 11 May 2026 09:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778517562; x=1779122362; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5ic4BaUG28/kqkN2pOVPcrp/DL/iwy8HK3B1u3S3Yl0=; b=TlB60STR83zhcPcHHaZFv74W0MXbloZYVjhkFCMZ8VKdisV+5L9/e9TNGdakbpgLYP ZMhSm7FUrms1kiXiL2I2R4p9PJn/sA7GjHs3Uo+B+ENCFModapIkzgFLFG8qg870R7mH 9i6h2R49Pv6giLmH4BdmW/dP5JBPB4JUUq4jkliOcH5zm8BxP3UHng6N2ZZVd1Jyfw3b y1lfJzwYXLVk83sLAXUYrtlJhj4UJmEayqK7CH7SNz8Z+ZJb118EOHGhL86vDCorluVC iGWfxNYtWt/8+q/4DwhWtmSB7uU3T6wrezr6HHUViNYeU1O1UHr9vOofl70Mg+1OnuqB uBJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778517562; x=1779122362; h=in-reply-to:content-disposition: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; bh=5ic4BaUG28/kqkN2pOVPcrp/DL/iwy8HK3B1u3S3Yl0=; b=ZekjCVqzH48ufX4G7lKLjGsoDyUdlhkCNNymtQeHHn3p+OzWLBPmHqfvtLQcprVQOA F+eHDsUR9Pue25vjS/2psVW069FcR9iOB/ekWGk11tLVMxEUcXz8LQ/M2MxjSH9IJPnf sRgSOLRdKaxd4GaPLAMC0C9dVsnS+kA0ya0plm5cIYI78pQUUz9CetBQWAckme4KdvZZ 8JOBiLHsVo6TY8+u/wxldnYWrWIGztaL0tlJnVxeGsGYnxR6T0B3eUeHPM3GRfDErK/d PNC7aCfwpusQurKbVuTmOCa3/rU6vRIrGmIXXdRU0OzuaeyEZbC9uKf5G9rbGnTo30Ru GSUQ== X-Gm-Message-State: AOJu0Yz/3nOwONKnmTR6DEluwhjFkXwjetydp+A9bfPZASCi++OYQ+j6 wQ5QI87y3p+0L3uWnDrPVW0Y13gRGdqlqKl27JRmQulgVfMO31Hb7eic2RlATJ6lvDk= X-Gm-Gg: Acq92OE6fFQ9BelHFmgvrP32fefjYgZwY6h07Md88JakjeXsDqMRKmKih0J+2tJ1GCK XoVgQY7oUxeRrpMd4rniRHCaShIAV0LT8Lb4D0zDki1hallYz7cXN8eSfP2RhZykp79ZSCKs7vV w8ZReTgCw9Ry+RiWCsKjYD3Zh9oz+SOA+6sqQbfMF0Am2HC1Cufg3CaRZVE7yhC4ZBhw2mryG8R bTRohtm7zn4Cq1HDzi7yl1tJUsuSw6zqjXBVVPfC6O0TEY0rCft5hT1sJwHLBB30uTK7dGlW8SA tCr+whxPnr8mCz5IARZ1POVi6siu77533p0+jhxWCUTR3sdgZdug8oBDzfLICBPOj/7uT08tAru nIibNmWqukSRxme/FWKKcVIkKEzyQjlePzSgBSa1C4zX8fmIW2q2hhwfMrfVSULTEGImcvLN5/n WAhP/x4+dnXScNGXu5qbSFyZpjggEs0U6VHI72M0F5/K1InU86IYZbYn6LnA89tgFCCSiSOD2yH 3jxzJj1j1wc X-Received: by 2002:a05:620a:3706:b0:8ee:21b3:2eb5 with SMTP id af79cd13be357-9090e2f7bd2mr1517107185a.6.1778517562231; Mon, 11 May 2026 09:39:22 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-100-36-248-188.washdc.fios.verizon.net. [100.36.248.188]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8fc2c9229c8sm3399020585a.36.2026.05.11.09.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 09:39:20 -0700 (PDT) Date: Mon, 11 May 2026 12:39:18 -0400 From: Gregory Price To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli Subject: Re: [PATCH resend v6 15/30] mm: memfd: skip zeroing for zeroed hugetlb pool pages Message-ID: References: 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: On Mon, May 11, 2026 at 05:03:08AM -0400, Michael S. Tsirkin wrote: > gather_surplus_pages() pre-allocates hugetlb pages into the pool > during mmap. Pass __GFP_ZERO so these pages are zeroed by the > buddy allocator, and HPG_zeroed is set by alloc_surplus_hugetlb_folio. > > Add bool *zeroed output to alloc_hugetlb_folio_reserve() so > callers can check whether the pool page is known-zero. memfd's > memfd_alloc_folio() uses this to skip the explicit folio_zero_user() > when the page is already zero. > > This avoids redundant zeroing for memfd hugetlb pages that were > pre-allocated into the pool and never mapped to userspace. > Same thing here, seems more like what's actually wanted is to sink the folio_user_zero stuff into hugetlb.c rather than make memfd.c request for zeroing - and then have to check again anyway. ~Gregory