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.129.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 20E5B2773D3 for ; Thu, 14 May 2026 19:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778785705; cv=none; b=NV/4vdQsu280VNvWN/wUvuJBfA22qVo1AJJymh3lh1gcERtOPHpOA7rhVRgr/jPpO4b2+RTeqYADzpM5t+fcf6ZgGFcBC3ueCykIoE4KNyysctQGLbnL7MQtXulbcgSWCF47Ah4YPjjDSYHRgRqLNIQdGOEMdLWy5awKrLpEgIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778785705; c=relaxed/simple; bh=YPbB8kaYOpNPhNCkPvBdMTch1YgCmXjdWlb24weNuqU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OTcNPJM3MvQX1MGHsDvv4kayVq3X8RZbuyJCLqygxJqWu1EW9TzyjvlBjlZEvaxppcoL0ec67irhSpo4Hk6N4dTLwp6d5/EF9RWq2bPGvMIuNi0jyp+Z5GGiK2u3R3RzdK7mPBbUOYdb70m7yGMSRB7OYLhAD/YMcdEBgHx8iUM= 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=WmO7DKJb; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=suxyjIHh; arc=none smtp.client-ip=170.10.129.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="WmO7DKJb"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="suxyjIHh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778785703; 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=2xKMY0TqKrMt3bc3tXaYFIaskKaQVgiNDhgsdldGKxw=; b=WmO7DKJbfZSfnQYgFHcA3+qhIw1DDUbW8NtKkl19akqL05uzeX0G7j/UneI8CY9TI6AIOz AICaJH+mFxI4VJHXZcQrE+NlcfdMspnIOV5xo+e2g4xrcr3xhzcET6UfZqCEDijkCw/gJV CuBmKTCV8hIm1V7xpdjG9a26ipmLh9Y= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-55-Yp3EqZ-8PcS4s1F2iM4WgA-1; Thu, 14 May 2026 15:08:22 -0400 X-MC-Unique: Yp3EqZ-8PcS4s1F2iM4WgA-1 X-Mimecast-MFC-AGG-ID: Yp3EqZ-8PcS4s1F2iM4WgA_1778785701 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-45e55c44ac1so524022f8f.0 for ; Thu, 14 May 2026 12:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778785701; x=1779390501; 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=2xKMY0TqKrMt3bc3tXaYFIaskKaQVgiNDhgsdldGKxw=; b=suxyjIHh6aeWKYPkbd979XtUxli3vWnuA6mWU70jNcdNPYRtNSFUAPwIdOBb+76eHZ eTBm6/IJwvXKUVSFJ3pg79Vp6ZLNPOi7jEh2pXxZpY9DiWT0OfpZXLR73AWmWVgIsCs9 TyjuJR/FIQsc0DwH4/ppRF9ls+a2kYFIK9oKYNdBY8ajCQtSiOrVk0mfnNMXoJeHAF0M MQhaW49w+yJp25sCoE93k8EbByTK0NrbKVyyovLAktH0YXvIfZsRvNjzBkFkBGWwp0c2 ED5jUy72sMVbdo9xtfy7Ok5BuYrDafLScvtrau9RTl5ovc2wMTHZNrRXZKu0hjv3v89k ngxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778785701; x=1779390501; 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=2xKMY0TqKrMt3bc3tXaYFIaskKaQVgiNDhgsdldGKxw=; b=eU9eCzRti56m30PMqNGigqTzzoGVS2C5Py6TT9we8Md2qz6NNS2QQi87mG+VvjgWxp V6TP6mUmYavej710IBPaAbcjHw6rbgWtpeH4HTVy819F2Rw27DjlW7Rk3BFaiqi/Df0z xArXxCn7ljdKwmL28kJJ6zT9M/p/IN7z49I3kC94TcsFRiP4yuAsGIh+WCdK6nxrEeU0 nAay8/92s2l2GNFKYExQVA0s2jpcOTVGQJTKr8x/Q1JBfp72hW3ZEhVpCytPycvjHhdo tRXWl/9jINcE47Dlwe1L8SNTQLqHYvRh19GVCK7HRRhz9UykFe2uA8pvWbEv4sAfUgbe DGdw== X-Gm-Message-State: AOJu0YwPCzY6EIRwXEdQR/naZL21KVFVFRk9V5DCzf9R0DY5EMF2o249 E9MgLLg5IFpf/7dl1l7u8Y9asbsBNE7ayvpmhejbelue73NkvC+ajg+2OME/DGImfZ9vvsR7qrn SJR8y4wrlDne91vo/m5ICssX0qvXBn+0zhVa4sbyRrkduQyRI2Y+uyMIKJitdgpYGHg== X-Gm-Gg: Acq92OESdPKQ//TNgQKjc+TDhWovVLVR4DHckohAd7CNO0Vwi1A3z8/zKnTi6V4NvR5 828s3WjaVUts1znkHlfTPu5ICTpr+5Gclp5HiqTq2MIi1kpngyvXbr0LuVV30KguaCgV8A3Gz48 S7oBlhvL4IIJnYranF2h85MFLCVzg+wE0YPPPnU9lVZjotx93lahYRhsykcRHLRVgJ/BmGbV86v R2NhaMGXPO1QwCUnlIfBrc1QxP16CrGjoSqzRQ4N7etOa/IIb1Be+aaYK9uQCfz4qiyq4kM8vMq 2WOOh8dCdKvfEBUKSZTlp/w8L+TZVYEQ1xVSKLEmkG8fcnPrlXPe0JYfwDLzpoUoyNN7PMaDll3 99jLALnicuV8E6P+5im99yne/u1aOV18qlE9y/fZc X-Received: by 2002:a05:600c:1512:b0:48f:e26a:1744 with SMTP id 5b1f17b1804b1-48fe60ecd67mr4946065e9.9.1778785700697; Thu, 14 May 2026 12:08:20 -0700 (PDT) X-Received: by 2002:a05:600c:1512:b0:48f:e26a:1744 with SMTP id 5b1f17b1804b1-48fe60ecd67mr4945575e9.9.1778785700166; Thu, 14 May 2026 12:08:20 -0700 (PDT) Received: from redhat.com (IGLD-80-230-48-7.inter.net.il. [80.230.48.7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45d9ed2f738sm8558986f8f.16.2026.05.14.12.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 12:08:19 -0700 (PDT) Date: Thu, 14 May 2026 15:08:13 -0400 From: "Michael S. Tsirkin" To: Gregory Price 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: <20260514150750-mutt-send-email-mst@kernel.org> References: <45d1ea85b574399459a64fdba28fcf04abfa3e7e.1778616612.git.mst@redhat.com> <20260514135214-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: 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? > i.e. the user address is irrelevant, and the caller is responsible for > sanitization before return if it's relevant. > > Otherwise, passing (user_addr != -1) the buddy takes care of it for you. > > Just an obvious security bonus to all of this, but by no means a > requirement for your set. Just an observation. > > > > > I'd do this on top if possible. > > > > Yeah reasonable. > > ~Gregory