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 02A763E7BA8 for ; Mon, 8 Jun 2026 19:46:07 +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=1780947969; cv=none; b=D0CgSaph/Cg6PO5QQFAAEdM8qaA4IWOTP/nw3q2M3r6dkY0z0oyhIpM469v2qLYCRVKGOS2ZU62t4VuhvFycFFPVUjOvWKTlZ5cWBDg2x8f+g2zkbdsWPqSJyJuegDZBixsonT/EBBm3/uORZK8rtuINm0e0cJPbE8AlHBAY07Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780947969; c=relaxed/simple; bh=HiesDSG2XitHdXdDDhZeaFf7JuMX1rHkw3DjlsPTdDU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bTcT8aRmvpqYBIsieSyb6TG35FG+f64VasNgNQAz30MHPiYRvKaQzjfYKXRUGcQucCDCGa/xmqbD8aQBRHaIZMR50N0EkG1RUKkkHjXLEaI5iRax7wHganadCziEZf5AKesv7tBPqLy4X4YarhMyLQ466D4e5oEHmKInokTZqQ0= 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=FS5YNG4Q; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=LnxL6i3H; 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="FS5YNG4Q"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="LnxL6i3H" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780947967; 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=4XkshBTgN4Zv/gIvkBzsPSwBPTNRhn2JGaJhvMxMoi0=; b=FS5YNG4Qzuw3CqdH6arVeFsPHaGB7GcowCDzkht35chflTX+gkcjieFFjaES+47cpBqC00 iYUUlBuPUwTje/UWh76CG2joVF3fFmPRfkvpOlRwgonYSfWKnI2IUb/dB00M52Qx1/Ey7U MUOMf3lRNzmYkEOZqCv3P2vCXyzYxKc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-Y5KqU6cyOJuq9TkW1bMqpQ-1; Mon, 08 Jun 2026 15:46:06 -0400 X-MC-Unique: Y5KqU6cyOJuq9TkW1bMqpQ-1 X-Mimecast-MFC-AGG-ID: Y5KqU6cyOJuq9TkW1bMqpQ_1780947965 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-490ab3f6e55so15770725e9.0 for ; Mon, 08 Jun 2026 12:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780947965; x=1781552765; 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=4XkshBTgN4Zv/gIvkBzsPSwBPTNRhn2JGaJhvMxMoi0=; b=LnxL6i3HXbskmV06yO/neEfnktXKj5WreepJijjpcXA4oWoRiZ7+XXn5gK4KGJ+PAG HKPKuV/C1LEp0YmPuEeLaAsEYbmJdOw8me/jot1wwynCBb18U/vEYG8V2F9oqziO/bWB uRH3qsobiJ6iBfZvsw3Sa82muYJdams6frtpuEsadnj9uP3DvnY4I2EEhcvLoB9y//bC RLkBrm7QxcZUP0tgC7IeHLbrkqkrrSePWgAgBix3w4Imhkoa+KdURxk3c6ZYxQ8tu+Xc NohhSdf0Z+yIbifrGfU28j6zPa5M/fjkoofb7fwC5c+oXSLt5pUl8DXTc0Hs4SGVgVbR xlGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780947965; x=1781552765; 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=4XkshBTgN4Zv/gIvkBzsPSwBPTNRhn2JGaJhvMxMoi0=; b=Rx+cdHpn5nCGh+2Yz4RUaEbuaT1PW58lhhgVlgwOThcHr1CivaEk3KarNaPsZnyGx8 p1Vo79Kz+FhV5hdNXpaO3h9xzzAIylMspDYKSfGL8jqCoDCgwXTjmhCRWkb//2x0ZMHq dxPofJFrnv9PRu7jc9+qetQkqDD692lBUal/b+oLOVb5mPPlfhgd+kAwSv+wowy7QFT+ X1kA5ssOfprqzh7n3n9TiCTbHPy2nYuXTyAxGEdqGRYZuWs0hLZfHL4jOPDw0Jkyyfoh CWSnqQmnlzykfG01quIFr2IoeDTHmlVrffjUfQPNX4dGf6mHcK0rRNixsL6GDHKaMygl 3GXA== X-Forwarded-Encrypted: i=1; AFNElJ+54h47I6spiJHB+NjUOJAXZNkwH6oEFdQHEQ56/3N4Jv1DmiInJDZwn7U7f5nzQFqHfiyaTtQv3U2epLE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy30f5N8qcRwJDvTtPKm52RQ45dMZ8HXjXtc4Z9QEEZWwdJBcQG B6zCel48WJT6honkWCkTu5JgPLry/Aif4dsIFJGrt962FiEIZOgdbBt0zp2qaT6/B7bWZeVX64m NAf+z+1e+c6hl1JhR6ZKrouJdbMyJ1d3pN23wjRjIQ5K+eRxRMYHoG/v1LRjt3M0pEQ== X-Gm-Gg: Acq92OFkdJfw3iUueZG8zTM3CTMNEDpVaBEj+nZFt2qJDniEuzuoYn0zdzxO8WUzNbG lMaWqFWzTw5RA1qqryvY9ZMDh5SEbS5ElrNjqafs5aZ4vsWe2Yl4Tzb7xbGU0bwIGSIfKsSot07 TPe+8X7dod1tR7HJ0WWpoWkZ6hfRNpGlDbs7CXzDINF0SE4yc51TfH7RBGDVgMeKkTRltKH3P+D HaZGhzRQl/J6FQDx0dwQsZ3L/MpYuodmdycY2870l7TEvPA7/VA8HWmrsBVeYiqynKRM48Chb2w eZjZP0cwVKYNTh/FB1r9A9kopbr/Shq4Abm8CuKBG9BON4wYojekQxyG773uAB4DpZC7w2JftVG 9srPvz4FyaQLtRHNnKcKAEFY3FN4AhHYjrSGbvrLsjfTkrm5sBsCjSQ== X-Received: by 2002:a05:600c:468c:b0:490:469c:556b with SMTP id 5b1f17b1804b1-490c257c3c8mr290868135e9.12.1780947964688; Mon, 08 Jun 2026 12:46:04 -0700 (PDT) X-Received: by 2002:a05:600c:468c:b0:490:469c:556b with SMTP id 5b1f17b1804b1-490c257c3c8mr290867255e9.12.1780947963943; Mon, 08 Jun 2026 12:46:03 -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 5b1f17b1804b1-490bc3d663csm465687715e9.11.2026.06.08.12.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 12:46:03 -0700 (PDT) Date: Mon, 8 Jun 2026 15:45:58 -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: <20260608154354-mutt-send-email-mst@kernel.org> 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, Jun 08, 2026 at 11:53:40AM -0400, Gregory Price wrote: > On Mon, Jun 08, 2026 at 12:23:07PM +0100, Lorenzo Stoakes wrote: > > On Mon, Jun 08, 2026 at 04:36:38AM -0400, Michael S. Tsirkin wrote: > > > > > + * user_addr != USER_ADDR_NONE implies sleepable > > > + * context (user page fault). > > > > Can you safely assume that? Also inferring which context we are in from this > > parameter seems risky. > > > > It seems to me that you're now making it such that kernel developers: > > > > - Have to know when and when not to specify a user address, and under what > > circumstances we might consider that to be mapped. > > > > - Need to know to do this correctly for aliasing architectures or have silent > > correctness issues. > > > > - Need to take context into account when specifying this. > > > > We definitely need to find a simpler way to do this! > > > > This feedback was poked at in earlier versions. There's a tension > between keeping the old interface as-is, having explicit interfaces > for something like this, and the state of a page inside the > allocator vs outside. > > Double-plus complicated by the fact that we're trying to reason about > two allocators at once: host and guest. > > It seems it has gotten a bit more complicated since then (I missed this > "sleepable context" bit, not sure if it was there on prior versions). > > 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. You are saying it's bad? It's pretty fundamental to the idea of moving zeroing into the allocator, I feel. -- MST