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 E05A4305682 for ; Fri, 15 May 2026 15:39:24 +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=1778859566; cv=none; b=uekkBJWjDq1+DDi1xFpvdMiw9P1rqp+lmH3bZmM6jE7Mla9z7TiYFiBIMysHSLNT5WkYtuqp4WNNOb7IzhuijmDiDgYGXLo1Pd/ou5PLXgZVi4HBvBvqUv1zoHJ9EFwIVtLkwh97DRGLpwTYfAVjOQx7x+qSc35SrGs4ZQQs2Jk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778859566; c=relaxed/simple; bh=TZ6FN0evsU83Qkybe8h8Hy8iiimz3lCzOXtq52eCjv4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KqLSq/KHa4vFMCRx/PejIOCPLehvwdcBO1v2V4CAt3w1EeOa6hAKxSVJOlJOLfWlh9pPAdvGlLo8OS4gJv4KMBmQz18Do+WrWVoIh5pdzmYs/fTr9pbR1DsNn6NJbSJYqd8uBGZhSdEs+1QkWK63FAJBOwU4+SpoyJVfuHncTHE= 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=GDBwrR96; 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="GDBwrR96" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-911501a99feso192284185a.2 for ; Fri, 15 May 2026 08:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1778859564; x=1779464364; 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=vcnoZCj9StmYM28UVGL5OD3x4745ox3PgFdBX56PHJ8=; b=GDBwrR96jlHI1cNrjUVDo3HlqrUYyNlMtVWm3SCVAf1T2QyxWFJ2+IdCf/7WLDeAaz TlPG4T3WB3uhYrBRAzEBiJP88rBuwe9HcFLFZ/h+ZObPoqs9UHgmmX0nnCGUCCk2LgO7 QynKG68kMzTwXSog3l0hj5TxvA2J04rUlcjordNnxOwtkKWmzAG7qvaF1lZ2HDRew33Y C64XkqWuVl9D5k1NJS1co09ktbSrrDB5baNHzSb9ksxcoB/e8JSQrI1q6/lAhOGCsQhB wmRjw3cpEx3WO50oiS8Ij9WYaWH+ttBEgaT2UbPA3+uASYUCYDiCMJmIBOTdfnK7xVy5 bfjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778859564; x=1779464364; 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=vcnoZCj9StmYM28UVGL5OD3x4745ox3PgFdBX56PHJ8=; b=FXm8K0EyZ2mBLa9dHBd97xlow8ZfICwYTjTuDGsBIwvU80Eb+bgcx3s2G/u0vASs+p ny6+Bl8g+AboaehnVCVgW7FlWsA/dZO73+VHnwWwA9AfrqJ0ffb/mxx7meIxGyHtpERc +/nPIxhnE0NzZ5iH8a2XqxnPWD+Sp85qayqwNNxbdjjl/UsZJR7ytjn3d8PlAJ0R4s7F K86trdC8X0Hg8cK4J7RnuUGpu+4VR7oaAofQvK12jGXjPymbcFyJbh4sUNsXLSBaemyu oiE/pHJb5RIhvcN33xeCP6iaQHxH9cgdyRBAyiOej9YFMx3kCOGLOnO8jrKHZMWKQ1M6 2jSA== X-Gm-Message-State: AOJu0YzRMkp8r1IjS3vZG0udNf+Zb5bWaGMRFrQDHrjTeu2CB3JTN1f1 D7NNuxUqH1IE8fdOYnqmp9nos2U8F2RyqsM19M3neex2Ibf2G+SKBMlG2BahfOM9mrI= X-Gm-Gg: Acq92OH45V0u/ciXEpTEbMIlRD6DmPf9IiqjLy/kraUG+3/+L6EZFI4pSdhcseO+NXH FDx4iyqkWy4GfOON6pzmB5IHktKt13PjATnotrOkX9A5HEZnqBPmnUWnpxoPs4ja1V/HljYBJtM DKkdaTicq9MqvA+bKfhpw38eNHJAnNhch0GJcbmLmifqy6PtcNyIWcStTvvgKaOn4Y0XXw6YElo rx52LLoPOap1hfNgbjzurbQosjqkHseUYSZIN0fGqxE0xqUlv+HiOCedgD4N32G4e7+GQBiXOzZ 03tWbE+pEi6WDvFghI2zH/qQBQt/aVuXxlH/wHjtHja6Sw+exRCLH8MjvYlZABqj76K48djMHU3 iF7hv1FQO3xaz8V6YPw54B8ADT+nYiP5vqLycgWXi9pW4UwcR9FzQM6twd/a6MdZu64ksI1lSLA UCJrUOHNuaXK/oyI51W706OLoKEQkSwLvq/z4PESn4cPKp29OpMJJOhM4PfPTxvUa9ndxZHj1ii Y/xDmv9pR5DYwssUw8GSJ4X8/v1vomCog== X-Received: by 2002:a05:620a:12da:b0:912:67ca:bab7 with SMTP id af79cd13be357-91267cac05amr271493385a.2.1778859563525; Fri, 15 May 2026 08:39:23 -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-910ba36d137sm564275585a.1.2026.05.15.08.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 08:39:22 -0700 (PDT) Date: Fri, 15 May 2026 11:39:20 -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 v7 09/31] mm: use folio_zero_user for user pages in post_alloc_hook Message-ID: References: <45d1ea85b574399459a64fdba28fcf04abfa3e7e.1778616612.git.mst@redhat.com> <20260514135214-mutt-send-email-mst@kernel.org> <20260514150750-mutt-send-email-mst@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: <20260514150750-mutt-send-email-mst@kernel.org> On Thu, May 14, 2026 at 03:08:13PM -0400, Michael S. Tsirkin wrote: > On Thu, May 14, 2026 at 02:56:54PM -0400, Gregory Price wrote: > > On Thu, May 14, 2026 at 02:00:31PM -0400, Michael S. Tsirkin wrote: > > > On Thu, May 14, 2026 at 09:49:33AM -0400, Gregory Price wrote: > > > > > > There are calls with no __GFP_ZERO but they do not allocate userspace pages. > > > > > > - drm_pagemap.c: GFP_HIGHUSER -- no zero. But this is a DRM device > > > page migration, the page content is preserved from the source. > > > > > > - test_hmm.c: GFP_HIGHUSER_MOVABLE -- no zero. Test driver, pages get > > > content from device. > > > > > > - mm/ksm.c: GFP_HIGHUSER_MOVABLE -- no zero. KSM merges identical > > > pages, content comes from the source page (copy). > > > > > > - mm/memory.c new_folio = GFP_HIGHUSER_MOVABLE > > > - no zero. This is CoW, content is copied from old page. > > > > > > - mm/userfaultfd.c: GFP_HIGHUSER_MOVABLE - no zero. Content comes from userspace via userfaultfd. > > > > > > - arm64/fault.c: __GFP_ZEROTAGS not __GFP_ZERO. MTE tag zeroing, not page zeroing. Page is zeroed separately. > > > > > > > Right, so in all of these cases, it would be just as correct to pass > > USER_ADDR_NONE I imagine :] > > Hmm. Are you sure? Isn't the address used for numa policy? > You said "They do not allocate userspace pages" - so wouldn't uaddr be USER_ADDR_NONE anyway? Even if they do allocate userspace pages, they weren't passing __GFP_ZERO before, so either: 1) They did not depend on the buddy to do zeroing before, and user_addr is just a dead variable in those cases anyway. or 2) There is a bug, and they should be zeroing the page. I just see an interesting hardening opportunity. Not suggesting you actually implement this, to be clear, maybe just documenting the idea on the thread as a potential follow up. ~Gregory