From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 EF8A2409607 for ; Thu, 28 May 2026 19:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779998046; cv=none; b=ucysWkygRsrKVygovA34BES/2tx8mrw0sAd/sPgME/B0hXNMprqk9DcPbrkw3q4r0qn/ennfHNtmWmK1YXyqA5yGJ8NeNhhRgjgho30A7j4mtMQ4DbTgj8cGRabaMQ09XW0av+Nch/EVI0B/wBVqreSvwy86d/SFaxrL+X1o5Xk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779998046; c=relaxed/simple; bh=tkYwiPexmCFy1xVdThNBUraltDvdQA2A6n5FvjBLCio=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gwE+CMaiSJFtnnUZJRG7aLt22aKXNT9VDqyXRNposo2bQsxD28SBwmM4gOS2BeEJRHEOhwqpqCRRiXMR74VXtDnQABXd7n1jKhGJM2aNBURG9mfzVGC8cLbXfSAdy/1EP6o12qsXjwTrVspUIhQMnGCB9+UbsaS3HS97Gwb5Uuo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=sq+0j8Cf; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sq+0j8Cf" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-3680540a6efso7522587a91.2 for ; Thu, 28 May 2026 12:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779998043; x=1780602843; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=r+YVYuHV31+YDueuv90j7QJ3IHdmFzFimV+6UaJiJI8=; b=sq+0j8CfzfjHjxIfOSwDU3al73qMU7o1+qxw/1FQS3xMc8N0OwMPqpxORX7GoNimYE gRgDmchpo9hlGQwK+f3yWXJl5ePj/L3MZqw3RgE2tAxZ/kEcm8KDw+xbjICnuS9/zHJR KytU9c66hEpxUtClUCKlrQ2xLrOzb0LH+7E1Tn3D/0jDo68uY6V13Id7hh8oByLVzudq lW24f8tBKJQpKQPZKngrIkfubxFctaUnNAUkZlSRjRkU8OTunCBMPIoAA1958le0Iv5M J81FZit9vJ+4LrCKNKH3kdwUzQueD3/gZkLulu5xF3mB2AlyBKaJOuB++WRpq3hGCaWC UeLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779998043; x=1780602843; h=in-reply-to:content-transfer-encoding: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=r+YVYuHV31+YDueuv90j7QJ3IHdmFzFimV+6UaJiJI8=; b=eq1nqX+NrIho+NjPAfMln3uEzRupbMFYI7b0P2XNpLNbScxDT9NWhuntNrarWYW59K qMCFw4URYrbWOp3t8uaR71ayh85BqZhmieY9fyAJTpncQpAe4wN0XpnCddJG6RuhgC7/ CoQpc8WHVfF5sXqrXiwQoqGLidvpNw8DWOeaGSemlFSc0zuFwAfF31phvB5+mU+FEyT/ Cv7nwbSsgVfYwHvBAUlkSf6Q8ZktkZaB7+X2rdtA38maVUm8lqhrGMxY+B6ctGGDTZdi qSDDSN31+Fl4CozUtAHWvLBnDypM9TwuwIWoNkQKcoRZJ/Y6NBKsZv2ncG/VjplPcCHz JKoQ== X-Forwarded-Encrypted: i=1; AFNElJ9ujIoc2Fmo02b46x4AhdHpV+olP5UmHjcNF0dUbE0nBvv3Jxzk3wrMVmnv27eiw7MhhqZoOZGemU8EaX4=@vger.kernel.org X-Gm-Message-State: AOJu0YxvkOvHYC4ZP/QcTqeLTkkgLQknojcPcrAg5rJXh0BNI1S1vcej M1eAsSSZxIkvW4glP0Q5zGzRW6fhdm8g8tiwZazTflGfEpVlThgNEN7W X-Gm-Gg: Acq92OEHEYLd28679EKwR0VXk2zojSPFVFiAG1C0Fsi+GTaMCNcHEvQ1OLnHKRYMrEx bLa+CvNyhmx2f4uIoBIBbpA4qtS+e/myggQB0D9jmw55UUIUDK14w2dpN3/9QVOKL8q7Zn1dquW Oz6YP0dL/mXVOIIUQGqt3F/+ZR/vJJCeYrdM5wdrTkVJdGO0Y8tbmqqu1CEpwE8EabUaLhn+Ymn MIYXScz9bDHd/WK39+YsPI0sARtfZ1asD6VvpYJjKVIH17O1d5BBzZMXRffOea7jN0ukBxZcUSa VZcdsqtfOt8MM94D5EI/d4zFEXvKuVQr1yb6X0F1yIJtPiTSB5F9BgrGTi3hHP+g4NreZXcbbOj HcengMTfEj1Vruvc8HuTsVhtL6FA3sztxf/vY1cLnwMyrNYhBEW/xc0yJ31+X/XY3Lz2vL9kUCD ix6PV9HzDKLLrs9NwSIW8Q7bMpGS0EHTzYwxeDgAMaWTs/lGvIjVjAHIlWamU4GLNUjclcnrn4m aPh X-Received: by 2002:a17:90b:2682:b0:36b:ba9b:7efb with SMTP id 98e67ed59e1d1-36bbcc14892mr34605a91.5.1779998042998; Thu, 28 May 2026 12:54:02 -0700 (PDT) Received: from skinsburskii (c-98-225-44-182.hsd1.wa.comcast.net. [98.225.44.182]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36bb616d646sm398548a91.11.2026.05.28.12.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2026 12:54:02 -0700 (PDT) Date: Thu, 28 May 2026 12:53:59 -0700 From: Stanislav Kinsburskii To: Andrew Morton Cc: Liam.Howlett@oracle.com, david@kernel.org, jgg@ziepe.ca, corbet@lwn.net, leon@kernel.org, ljs@kernel.org, mhocko@suse.com, rppt@kernel.org, shuah@kernel.org, skhan@linuxfoundation.org, surenb@google.com, vbabka@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/3] mm/hmm: Add mmap lock-drop support for userfaultfd-backed mappings Message-ID: References: <177928604779.589431.14703161356676674288.stgit@skinsburskii> <20260521163309.c5cc5d3f6cf16bac212cf90b@linux-foundation.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 Content-Transfer-Encoding: 8bit In-Reply-To: <20260521163309.c5cc5d3f6cf16bac212cf90b@linux-foundation.org> On Thu, May 21, 2026 at 04:33:09PM -0700, Andrew Morton wrote: > On Wed, 20 May 2026 07:09:19 -0700 Stanislav Kinsburskii wrote: > > > This series extends the HMM framework to support userfaultfd-backed memory > > by allowing the mmap read lock to be dropped during hmm_range_fault(). > > > > Some page fault handlers — most notably userfaultfd — require the mmap lock > > to be released so that userspace can resolve the fault. The current HMM > > interface never sets FAULT_FLAG_ALLOW_RETRY, making it impossible to fault > > in pages from userfaultfd-registered regions. > > > > This series follows the established int *locked pattern from > > get_user_pages_remote() in mm/gup.c. A new entry point, > > hmm_range_fault_unlockable(), accepts an int *locked parameter. When the > > mmap lock is dropped during fault resolution (VM_FAULT_RETRY or > > VM_FAULT_COMPLETED), the function returns 0 with *locked = 0, signalling > > the caller to restart its walk. The existing hmm_range_fault() is > > refactored into a thin wrapper that passes NULL, preserving current > > behavior for all existing callers. > > > > Faulting hugetlb pages on the unlockable path is not supported because > > walk_hugetlb_range() unconditionally holds and releases > > hugetlb_vma_lock_read across the callback; if the mmap lock is dropped > > inside the callback, the VMA may be freed before the walk framework's > > unlock. Hugetlb pages already present in page tables are handled normally. > > Possible approaches to lift this limitation are documented in > > Documentation/mm/hmm.rst. > > Thanks. AI review identified one possible issue, possibly a duplicate > from the v2 series? > > https://sashiko.dev/#/patchset/177928604779.589431.14703161356676674288.stgit@skinsburskii > > I'll take no action at this stage, shall await reviewer input. Please > poke me in a week or so if nothing has happened. > Hi Andrew, A gentle reminder as requested: do you think this change could be taken into the mm tree? It's beneficial not only for the MSHV driver, but can be used for post-copy live migration of GPU states in future. Thanks, Stanislav > Which is quite possible - things seem rather hectic at this time and > we're almost at -rc5!