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 A21A033555D for ; Tue, 25 Nov 2025 19:21:23 +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=1764098485; cv=none; b=pQBi6yj96Vi14UsnXxe+nTLEJ0E6e7ziVN+23PP/M/Dob6i+8uUzIxnKw8Cvi/lOQNFscTYcwuf1Jund9py2sConSNMFDF7nTsyUXMJmoyD5GbI066dTSaB6qQEmAIJ9iIrCnk3C9rHmlpRfVJdWBf4bBKajYtmmdB8MF+4I36o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764098485; c=relaxed/simple; bh=HqayHoP1kvtY/gdJ3minqrH9s9nn7eYqWOg3b1zRuDg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ib36q3Ajhv+askI092p465KpMYgBrU3Wd6rjyghaf2XsgeOpi5J7qu1dfbNndCdHEw1wWD8znNnMXHs5UiU8Jddv+vTdHkU2gaDTPR1C2zyqG+C/vB3OwrUPROwc1RU4yE3eLxsqbDAQZruMEwwpM4HVHO9V4alSrNCXXhdFTLs= 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=M4eRE/SA; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=s4z14ezq; 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="M4eRE/SA"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="s4z14ezq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764098482; 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=6qx6sgcmtbzfT8nlrCbJjKmeKver9dtlckhLCSjjEuU=; b=M4eRE/SA+nhqPLci3UEDOG4c3cVLyfOIf2O3J1z5dLg6EKr6DjS60uNT3BIBxXLVSNPnA2 8vTGkJZ5/VZg9a7Ub6TgQ0RGFgBr1hEh5tyAlfcmkdsZbYRL8fJpOiBnqqPA8YmwLUPUt8 kK+kQnJEnt07NjcxYNCEk5G7WPQLIQc= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-tE_TMqomPGaTjSwwLCgt_Q-1; Tue, 25 Nov 2025 14:21:20 -0500 X-MC-Unique: tE_TMqomPGaTjSwwLCgt_Q-1 X-Mimecast-MFC-AGG-ID: tE_TMqomPGaTjSwwLCgt_Q_1764098479 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b233e206ddso1464796985a.3 for ; Tue, 25 Nov 2025 11:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764098479; x=1764703279; 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=6qx6sgcmtbzfT8nlrCbJjKmeKver9dtlckhLCSjjEuU=; b=s4z14ezqOlM0RNI8K6CUTrIlP4K3o2L3IV47hAOpMOZqauiirSVwp9jRnhzk53H7Pq adzBZYOU0a0lOzUfpKwsb1p7cVKZUTZnW+jW8r9F/7OWcZQMeksdz1LfcOzpJaXcu/BA ioPzOJNqTcqAYXzFruGJlQtjSgrAshjlXkDUxXRc7gyMBJeXH+yxC5XC+O5ybhYTSDNn ygdgm2ZS3gJQF4JIg6HgFEtIgj0Boihl3nUuy7/sbbMjUQcFuoQSbsBoyWlx+QhvtmgZ QQG3k2S6vg2e454izDUg3ENDhBfx4zaTIcK8wls8FT+rVIFZ6GP3zCUC9RX777k9oy0H F8CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764098479; x=1764703279; 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=6qx6sgcmtbzfT8nlrCbJjKmeKver9dtlckhLCSjjEuU=; b=ZyQx+YDUeEPHBOdDAb3zEiuQO0JQiFlnW0Zkw5a5ywH8nPnVs4ijEJG98BvGvZ3w2h Xlq7/cnZF9Gx7wmaQJgYYZNaFm8+ib5F/mn1vU517pua5CFdi2AOdwK9x2AP1cabDuad 9sddMJRtn2XJuCnTKN8PcUn0Am6c/a66YQOtSSFtiyGP6tnPrN5KRwBypCsJsC8RztZu iL0wV4xfKP45hQUP4PrcEAam0LfT4DtNiqEMndXnSysfpvQb0mGgaQ2xhnJikgJBrC7y IISz341f/nh0iYEI03ZFHC6bC/Xf+IFMa6WIdUoocp3XmoL0j0MNWt/FZn3w/VGg0h52 sGzg== X-Forwarded-Encrypted: i=1; AJvYcCVKNoc9ekVI05O3StmoqZoFdH3JBQQxdhJb7WKc5CjeyfouQlN5M6NKWMNGemgTudqV51uPADCIC+s+31s=@vger.kernel.org X-Gm-Message-State: AOJu0YzBgwyHtLWE97yXWXW510x5WjRmxhAwGhNFCfBBTx72X0avIYzc kXv8BWVSR+RbjVnb4tCwGebyIU0iBhzMIDeFJdmWhEU81e0KhNQpbdfdmtWfM6a1OrWAluw075Z ppuoY9xC+SY66xVtj1S5WTq1xgwRi+bOzVDfF8wFz6JO+KCACWVfYSieaiAw6EU9B2g== X-Gm-Gg: ASbGncsQep4E3aaxzCFf3HG098i75G+ElD4voIHvDdv7tEFh43nZpv2yzm0IR6m0gzB FguzjfC+aREWU/XAeyfBpqvwJs/dZR978Dg+f9irmOTnBf6uB9+dKmeFxjAiw8ibmNaCufPdHaH qNPCId4dfe8W4o9ZDVzf0cioZG/TIWWOJe0JxZ1sGuuhiimxeFwFGR32IqnnnTDyDtCDx1+uY8k Pe7W7O9lYbhohUFVRdkx6oihbz7/EBBNK1RjWNVtu39zZmJIiU/f7lS+vNzGBxXdq4iRFGTTNdc v4/keixhOllY86DNxTx99+MCkMri4mqM06Tv6ubZAukp2/0t8UZrjA/Ic9oBZ/dyfaEziESJROG wwxU= X-Received: by 2002:a05:620a:700b:b0:891:9bb6:6b9c with SMTP id af79cd13be357-8b33d4cfb76mr2360727185a.44.1764098478772; Tue, 25 Nov 2025 11:21:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCwC+zV9ilL/kZYBgogz1BW/k0XjgDzjkTt78Ehqb7OwOZ4OSkjcxPe6SUz84vf0wVoVyZhQ== X-Received: by 2002:a05:620a:700b:b0:891:9bb6:6b9c with SMTP id af79cd13be357-8b33d4cfb76mr2360721485a.44.1764098478205; Tue, 25 Nov 2025 11:21:18 -0800 (PST) Received: from x1.local ([142.188.210.156]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b32953735dsm1226353585a.24.2025.11.25.11.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 11:21:17 -0800 (PST) Date: Tue, 25 Nov 2025 14:21:16 -0500 From: Peter Xu To: Mike Rapoport Cc: linux-mm@kvack.org, Andrea Arcangeli , Andrew Morton , Axel Rasmussen , Baolin Wang , David Hildenbrand , Hugh Dickins , James Houghton , "Liam R. Howlett" , Lorenzo Stoakes , Michal Hocko , Nikita Kalyazin , Paolo Bonzini , Sean Christopherson , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, "David Hildenbrand (Red Hat)" Subject: Re: [PATCH v2 3/5] mm: introduce VM_FAULT_UFFD_MINOR fault reason Message-ID: References: <20251125183840.2368510-1-rppt@kernel.org> <20251125183840.2368510-4-rppt@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=utf-8 Content-Disposition: inline In-Reply-To: <20251125183840.2368510-4-rppt@kernel.org> Hi, Mike, On Tue, Nov 25, 2025 at 08:38:38PM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > When a VMA is registered with userfaulfd in minor mode, its ->fault() > method should check if a folio exists in the page cache and if yes > ->fault() should call handle_userfault(VM_UFFD_MISSING). s/MISSING/MINOR/ > > Instead of calling handle_userfault() directly from a specific ->fault() > implementation introduce new fault reason VM_FAULT_UFFD_MINOR that will > notify the core page fault handler that it should call > handle_userfaultfd(VM_UFFD_MISSING) to complete a page fault. Same. > > Replace a call to handle_userfault(VM_UFFD_MISSING) in shmem and use the Same. > new VM_FAULT_UFFD_MINOR there instead. Personally I'd keep the fault path as simple as possible, because that's the more frequently used path (rather than when userfaultfd is armed). I also see it slightly a pity that even with flags introduced, it only solves the MINOR problem, not MISSING. If it's me, I'd simply export handle_userfault().. I confess I still don't know why exporting it is a problem, but maybe I missed something. Only my two cents. Feel free to go with whatever way you prefer. Thanks, -- Peter Xu