From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 A46213F4DF1 for ; Fri, 29 May 2026 15:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780068178; cv=none; b=ruaropZ5J85eyQyHxPO5xR5tOLA79nAWdVImFZOA+Hk3/VJ9zjoBSW7hEbdIZSqoNjDoLvsi7neGLQshUznJTf9MaYoaLmU7/JtXBI0Z9lx2AepR9jUcj4CWntWk9bBxFOOxb7haMlhzbKSDwAtI/WNY5SRopQcaf30BOfJIf2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780068178; c=relaxed/simple; bh=nrsmIXcyZYzWzlqPkl9t9uUpVmTvW8/nYuSQvt237DY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YHfwF7tnU6c8pLeSVKRXFqhmX2c+NqGl1oQItAdTU/gyW+t0bWwdV26GCUrwHdmoRL50DvMFDwWyoBaViP6cdp2cP/6JsutLnmOvEYivClsVj68nqXEgOIh7GxNTzsC4RjtD8laz3hNX00Pcytast5hxh6+X0s2IxaPZqgSgE7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NrMS/+Av; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=rNe7n0+Z; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NrMS/+Av"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="rNe7n0+Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780068175; 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: in-reply-to:in-reply-to:references:references; bh=Gi0K9k7DoK/Ig5tkAzEbdYCqiHQSfFH4LjBzL6zaPFI=; b=NrMS/+AvGK8G2UU45iMquP7C7KhQCiXeZlRAbzH6ec3m4VlbdMXu6H8NmNPqBK5yH6ZHWU gbofqMKvv//7dfSO1a4q/dhDAggAn0SezuQpAY5jKgOu52Vx5qWEvikizj9hMPYzidSvEb spvV39dSneHl8hiLzVrGJmqvevkxL8E= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-340-Vaw-hgc5Ndu4Au4vWxGohQ-1; Fri, 29 May 2026 11:22:54 -0400 X-MC-Unique: Vaw-hgc5Ndu4Au4vWxGohQ-1 X-Mimecast-MFC-AGG-ID: Vaw-hgc5Ndu4Au4vWxGohQ_1780068173 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4909deb82d0so5868575e9.1 for ; Fri, 29 May 2026 08:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780068173; x=1780672973; 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=Gi0K9k7DoK/Ig5tkAzEbdYCqiHQSfFH4LjBzL6zaPFI=; b=rNe7n0+Z9IMuaKCzU0QUbzI8OwbZwtTr1Mk81bgkbLIsYPsLwrzjZLvxNcu0RJH3pu 2eDn5kP2Beo8vWekDzi18wtyuBat+nVjxTh+pXvyVfkot8RpfK7ksH0WqVdVq2XbSZA8 tDJbC7lVu6RVIUMrDiH6LGb1c7Ds7JvAtqHrH+htduI5gEVIdJPKPNF8ZGWSbuGbBPhL QPe+mbMb+/X2Ip4doUKt11pb/r5fCIWeF+67RYMPUA/hlDUTEaAuLIDcxjsymB93jLgg MSAe18FWoAeuuxcZCFNwIeirN37FGyo5V8/QNLX5InK2m2V46d1f7B5WWYuMar38Kxq2 jB5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780068173; x=1780672973; 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=Gi0K9k7DoK/Ig5tkAzEbdYCqiHQSfFH4LjBzL6zaPFI=; b=WaVAMR6YNxeEJ/z6dd/VLUEVhnOzIqfPpYWrgjkUjv3SsZC0q2c603bz+6M+2MQtjN vps8p47J9w78X3pGBLpkyLwbrL2qHkLv8D+lcuJ9J/2d/TJzP7Vu2r/pbNLABaFR6uMS FqRqprhU1Qi3UGIdWR1MFz9VgJmo9XhAkbSmu/+Kt4mLIf6sIWB5UQYLtP4b1ZWe+tsV BhxOuidRA6KOSd/TBmkDax5vsmu61IC3plsJaRofF4tyEDDc6o9HMO0g0mAD0grQ2PNx NzSzMtFD0g43br2jG+db9HFIdwCSQBauBi6nFt7DptYM2LMxlnzGuKy/CvFiAWeaLAdC R+Zg== X-Gm-Message-State: AOJu0YyqDno7iaIfU57AgaTAwv07eUP805epVLqlb7FaPsQtK2gFDpha aNU9I5sYr58j5ODSKetIFFS3V3GBVM8Xk49zVZQ5+lmhKMhY0r4tMkl7J4RCXYiWUWgSV8dYGBS 9dzk7YsrbvpFHWXTzkVFCHy1Znlxu23bWRiri3FpR+12VUTM14CATilsBM3LEsO8W+zSqncbk77 iTKOVTQH1JdhjVobhqi88l7FDwIak+prBPcU2BqsYQk2A= X-Gm-Gg: Acq92OE3vJF1/0zjmi6u78VlxgXH5i6O0je0tYy2gw4xl3IhHIDREpe+xV19LEwnXvw 1eoNfwvJBPfV11OPqj2bCf3BdDg4IZltGGLQ7+pqe403zlh0l/UVVeAjTShpZPNnxS5KkKLblQy rTsV9seOn9ETNjogItmkbdhNQ0ru/0IyykVO4FV1ortRkDLMwZIqJd5KYmGbp4M/B1xrP6RJ5cz NM/3vFoLQLC28XIrRr54Y1oYK2vdlJIm4EO80FH8r8iaflDDEpyMFVDEO4Z5ZbStdDGM37xM11O 00RpvEaz6Jr5ALDzWPGqlfCk5t2RyDkcwrqMOM6lV+QaVlStyGNIldZMxHzWs4F0cfsk9WtTS/R dKLj8WR7rW11taFv+mxRne/C+s1dRV08cxFpdxuW0QlEHiL3bUaVi+w== X-Received: by 2002:a05:600c:4715:b0:48f:be94:d82c with SMTP id 5b1f17b1804b1-490a293bcaamr1010735e9.19.1780068172710; Fri, 29 May 2026 08:22:52 -0700 (PDT) X-Received: by 2002:a05:600c:4715:b0:48f:be94:d82c with SMTP id 5b1f17b1804b1-490a293bcaamr1009735e9.19.1780068172085; Fri, 29 May 2026 08:22:52 -0700 (PDT) Received: from redhat.com (IGLD-80-230-25-45.inter.net.il. [80.230.25.45]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909d6975e2sm75634355e9.6.2026.05.29.08.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 08:22:51 -0700 (PDT) Date: Fri, 29 May 2026 11:22:47 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , 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 , Gregory Price , 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: [PATCH v9 09/37] mm: hugetlb: thread user_addr through gigantic page allocation 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: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Thread the user_addr parameter through alloc_gigantic_frozen_folio so that gigantic page allocations can benefit from cache-friendly zeroing. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 --- mm/hugetlb.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a999f3ead852..3a6afbe99116 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1375,7 +1375,7 @@ static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, #if defined(CONFIG_ARCH_HAS_GIGANTIC_PAGE) && defined(CONFIG_CONTIG_ALLOC) static struct folio *alloc_gigantic_frozen_folio(int order, gfp_t gfp_mask, - int nid, nodemask_t *nodemask) + int nid, nodemask_t *nodemask, unsigned long addr) { struct folio *folio; @@ -1386,13 +1386,15 @@ static struct folio *alloc_gigantic_frozen_folio(int order, gfp_t gfp_mask, if (hugetlb_cma_exclusive_alloc()) return NULL; - folio = (struct folio *)alloc_contig_frozen_pages(1 << order, gfp_mask, - nid, nodemask); + folio = (struct folio *)alloc_contig_frozen_pages_user(1 << order, + gfp_mask, + nid, nodemask, + addr); return folio; } #else /* !CONFIG_ARCH_HAS_GIGANTIC_PAGE || !CONFIG_CONTIG_ALLOC */ static struct folio *alloc_gigantic_frozen_folio(int order, gfp_t gfp_mask, int nid, - nodemask_t *nodemask) + nodemask_t *nodemask, unsigned long addr) { return NULL; } @@ -1862,7 +1864,8 @@ static struct folio *only_alloc_fresh_hugetlb_folio(struct hstate *h, nid = numa_mem_id(); if (order_is_gigantic(order)) - folio = alloc_gigantic_frozen_folio(order, gfp_mask, nid, nmask); + folio = alloc_gigantic_frozen_folio(order, gfp_mask, nid, nmask, + addr); else folio = alloc_buddy_frozen_folio(order, gfp_mask, nid, nmask, node_alloc_noretry, addr); -- MST