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 8E13031F9A2 for ; Mon, 8 Jun 2026 20:31:01 +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=1780950662; cv=none; b=IhoXFq7E1cGbfLHKu4qSNcrNbcUtA6YOm/nfYO86/eytLuNwMxp6hvU7J8bUzZIyuwFb/j48RFCaqLGO17SBmeBcmINuEHxuFRZ8uaKkQFItwEBo5AOpp8v+XzDLzpXY0kxIKd3ecQvZ7WzxKbfLVkB8itW1XgwVvZz7sFA8ypg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780950662; c=relaxed/simple; bh=7iYFH83TbF30leOdmdvBc9fsaYOMEHsXM4LqnGKwYVM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LchFITXUKoaucq9iJP0zLJakarYmeGI2jKB4JJ+b8lgL36HSAyfKTI6mx0cnA/gZK4EPLBdTfOphOm9FvGjoFvGkle08DelOOggTpxNhUwY4t8QIMoYzIwi0eDqRASKlXVdOVavKSS9Pa2/wRnypEe2uQlgpHdav1iGCqljywiI= 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=SajcdGvs; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=GfRWh8JM; 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="SajcdGvs"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="GfRWh8JM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780950660; 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=wraIK7t3kueWFe0dHeV0rjdNvan94EJMyKFrwQ1Qu14=; b=SajcdGvsjkPdfWPuaR7BcoJ2ibwBD/vPdkXD03n78jza/Og16gafCDp3favfpBdPwQUvxz 2hGCMiuZcU+mAvxFNqCGpHCWbj3S9o9QE9QubTRFvTdX7FLLrpbC93MJV3Aqd0jbZsb1W+ BQxkwrYeJnqvLz4dGlxEs9VYvniwcEc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-IBQK_kwfMoyrBGTc7KZuHA-1; Mon, 08 Jun 2026 16:30:54 -0400 X-MC-Unique: IBQK_kwfMoyrBGTc7KZuHA-1 X-Mimecast-MFC-AGG-ID: IBQK_kwfMoyrBGTc7KZuHA_1780950653 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-490ae3bcf4cso23269405e9.3 for ; Mon, 08 Jun 2026 13:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780950653; x=1781555453; 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=wraIK7t3kueWFe0dHeV0rjdNvan94EJMyKFrwQ1Qu14=; b=GfRWh8JMtmJdZcONMnuG+d1bxVjCfL7EA8aVcmiTgLq42AbJYAXibB5csoKGQhkr5Q 4yXgFVfUT11KYGI+s56o1PXWz1Ic5hY56gzoy+IjQPHx1gT1PPduifeAzUC8TUHyu1/H 0YKYKUVXGRb224ejwNwQmOUD4Ax18GgUjg2go5s3NoMiuyolvykp2dDuJwAShVYOGqVF EpZVtZ5EBvPYds5giN+NR9MhnF5c6H3KOscSf3PHRcjeEm6oaFdsTWVUx5jiYN16ymp7 TGiIR1LjGe126o/YMl7bQ6uUHWoYUvMRcxBxWujQNhMcP+EemdGi+wD/rVrn8SUno5Ei +LAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780950653; x=1781555453; 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=wraIK7t3kueWFe0dHeV0rjdNvan94EJMyKFrwQ1Qu14=; b=BpqnOnL7yMKvXuM3zhWoW1P6PQXtZWqJKc0UlLEamnThuv/wHcsMpXWjW5FdNkv534 pjEY3kbpxoJ1yNflBPhjN3VNGK4INWlIelFQHRDCq1aHfU2Z/NILxOmxYhA0F1sj5IQg 9KhOnziwroSI3/LEU5GIyKcwHwgYeTw2LLNPn/WgEiW2C77OLENqoui+ml8DI3bwWSmg /L/BPfys/gA4QuNPQIY5jQb5Hwa2ZqfHsiGQMUhsj3ILj8Qh78GVjpHvcPSG2URtRHIH TXA49iycUYD7kj12NcgAkPMOCtoM3J04m/nRFuw2RXclQMbbc5BjjvxbYiPI+1wH0Tm8 GR2w== X-Forwarded-Encrypted: i=1; AFNElJ/Hf7hvrVRfQ0foHvDU8dB0brtEIH13SR/CftuJqRYzeu/4BdpQF3HxoYURJbf8RfDuwqJi5DEc3Ij2U0s=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1Sm1MgwFTswrp7uiofGxufZ288MXQ+WVmGEMEP+v1UGDiUvl1 AMVtwJdmlxWkxX1jmF/KP50XaNfCyu3v1HCvqFzNYBhxwN21rHzz00r7SzuoppHGNdJAo/goygb 1KB0UK5jUkG31GgmKDNW9Yf+wkCjR3HIt1tH4kX6PZ9W9YnCB29FcAOYOqxgOI2MjCQ== X-Gm-Gg: Acq92OGVyJbQcuY8PVC/+rA29A9Sr9OqDMFJA/kUVzj9EBWkaLcu4BSHZEeN1xOi3XK JeTxevkjQPIHthFIx+ebOwFcLQepDvbOWJI479qiroVFEn2geoD4mILNA09xb9jdZXj/W7aAAts 3dlEwNkmUICkDfdICfjDzNlRLGqvDIjKgAM8zVje/SP+EZIzox6TknbCNhv4btTqhQ0LSRi4rZl dvCnV3T3Ds8Ox0X+wUzPc1qnYSdheMNQnbz66Y1hCzibCW8HfwjN8/Y22XC19jCt0xcJ6u7++NS mVlmlimwphpuajCkAWMVHaDLIJCfn+A9XRB+XN4yAn9EX+6Ciay7NYbwTjQnYEpMcanBtHh4tNR TqAEWS2giRTKZy8jLx1rXYuIRF8BQNcYogwx7r0E4stmM4iYW5hY6oA== X-Received: by 2002:a05:600c:4e55:b0:490:601f:d775 with SMTP id 5b1f17b1804b1-490c259a232mr289729755e9.5.1780950652971; Mon, 08 Jun 2026 13:30:52 -0700 (PDT) X-Received: by 2002:a05:600c:4e55:b0:490:601f:d775 with SMTP id 5b1f17b1804b1-490c259a232mr289729065e9.5.1780950652571; Mon, 08 Jun 2026 13:30:52 -0700 (PDT) Received: from redhat.com (IGLD-80-230-85-71.inter.net.il. [80.230.85.71]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f0a43e9sm55339589f8f.0.2026.06.08.13.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 13:30:52 -0700 (PDT) Date: Mon, 8 Jun 2026 16:30:46 -0400 From: "Michael S. Tsirkin" To: Gregory Price Cc: Lorenzo Stoakes , 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 , "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 v10 12/37] mm: use folio_zero_user for user pages in post_alloc_hook Message-ID: <20260608161810-mutt-send-email-mst@kernel.org> References: <20260608154354-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 Mon, Jun 08, 2026 at 04:16:53PM -0400, Gregory Price wrote: > On Mon, Jun 08, 2026 at 03:45:58PM -0400, Michael S. Tsirkin wrote: > > On Mon, Jun 08, 2026 at 11:53:40AM -0400, Gregory Price wrote: > > > > > > If `user_addr` is now implying anything other than exactly: "This needs > > > to be zeroed / caches flushed", then this is bad. > > > > > > ~Gregory > > > > Well if you do folio_zero_user in a non sleepable context then things > > are not going to work. So combining e.g. GFP_ATOMIC and GFP_ZERO and > > user_addr all together is not a good idea. > > > > Can you say whether (GFP_ATOMIC | GFP_ZERO) w/o user_addr has the same > issue? I don't think it is because it does not call folio_zero_user, right? > If not, then this subtle complexity is now a tripping hazard. Yes. > Is there some combination of arguments here that should just outright > fail if a user attempts it? __GFP_DIRECT_RECLAIM at least. > > > > You are saying it's bad? It's pretty fundamental to the idea of moving > > zeroing into the allocator, I feel. > > > > I'm saying having to infer that safety state from the cobbling of those > things together is not a good pattern (at least as-is). Understood. Don't have a better idea, yet. > If the introduction of user_addr into the mix is the thing that causes > us to have to infer safety, then there's an argument the page allocator > shouldn't handle that operation (in this case: user_addr cache flush). It's not just the flush, we are also trying to use that to optimize zeroing. > > Please consider that this is arguably the most fundamental interface in > in all of mm/. All we're doing is going through the process of figuring > out what changes here are reasonable while trying to meet your goal. > > ~Gregory I don't mind discarding all of this and doing something else completely, but I dislike it that multiple people are apparently now angry that I don't address all the contradictory comments at the same time. I thought just sending a patchset to show how the result looks like is easier than arguing about architecture, and would be helpful. I'm not pushing any of the mm rework, I was asked to do it, myself I just want the ridiculously effective optimization in there. -- MST