From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f8.google.com (mail-pj2-f8.google.com [74.125.227.136]) (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 139658834 for ; Tue, 18 Aug 2026 01:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787016590; cv=none; b=aJEMTPEKCbv1Z8SpyTtAidv/9sIf71qGIbHqozqLuD7vNgRHswM+Pl8h8C1obx/af5otuiDz08zPL+KlxcI1Pczha+QNdggbP1/SD3zVO3Xx3J3+MBQrsaMps65+b6el8R33rvnc1UKpkPxLrbjBTZMT38F8RS1O11YisV3y87Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787016590; c=relaxed/simple; bh=7IHbVo6+LQg9qvGKEevxpIDiWSHrnyuGpJJr4ZRyxS4=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=UNVENN0us8aCrfk5ArefCTJGBWFSOMXaVQADT8gOutNRbtAuodeYPhlPE6yzzsvLwU2lktfGbSaMkCl46TeW65O/nRYvxqh6oLuxRWwt/6gA3JLqwH+Wi77sF1SyH+uwDO5f3z8fJNBNgzNzuJkXp97QxLRsgv5T/fjGUN6mqh0= 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=gS55Vv9+; arc=none smtp.client-ip=74.125.227.136 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="gS55Vv9+" Received: by mail-pj2-f8.google.com with SMTP id 98e67ed59e1d1-392c6555df6so2282721a91.0 for ; Mon, 17 Aug 2026 18:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787016588; x=1787621388; darn=vger.kernel.org; h=content-type:mime-version:references:message-id:in-reply-to:subject :cc:to:date:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wI+nXVhWBXmpzGybiKLQBExqkPKRniEJEvn4VEGH2nY=; b=gS55Vv9+bGZCxuIG2wgY5g0PTpcnnRLxLlZk29kuBC2v6YRXkQiYoO1PKPUMP7zG3B pVUGVBzikKvRi6txAYMG1RVUdRkFcJPqZtgYI2pTdngyX/VCNihDuNOaNQf1AcO9FO1J pEfLf0vjsAUgsqKZyPtCKDt8rchcdA3gzocAraSytED5o5AHe3gnle839/ULVFo6vrn+ NVB6oglSNDADOUKcKSqLE5aL4AyuBSMWvQL5f4uZm63bPIhya6RaLhufOtDtahtLInaM j1JaL3WxPA6OnI7BrqVJA7lFVClEzZ/CE6lPqHMiELbyipw9drIzE4mXZ3noCh9wzoRn Ewqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787016588; x=1787621388; h=content-type:mime-version:references:message-id:in-reply-to:subject :cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=wI+nXVhWBXmpzGybiKLQBExqkPKRniEJEvn4VEGH2nY=; b=jE6IrFFBGNieKwzNkDeBcnaOc9Weyv5tvHdYg/yq2F7QyjG0i4ZXZhktypEfHzlt4B ZcQEnBplBtEQM1aQsY144Jb3YVRv/5c8Ffo95IgE8kLfULPHefa8tjg03HZ2sg6Gs7KW xWnmiL/4TwTkKwTVXEEcuU6vH/Gp7jOywW//yA1eZlrJCiyqiVW1v9Rfvb1Wq7ReGM3W WLvZjhAQISjj8/IPDSPncvS8cVU4z3F5mhsaNBhzCtI8eethBbDS4HxN52MQI0jZrv+3 gFwOKa7hxRMi4DvOSLEsPoaHiHDVmDoMc3ecVQSPVPlAyDGyLjLpBafq9nyA9dlYyOqV me3A== X-Forwarded-Encrypted: i=1; AHgh+RrXYeOx4DTHglBrYO34qHiaf4N6DkPSKhun7L/Y4IRJ1JME+8V+pfqhwLuniZy0FbNdX37Gm3DlP0ZK1HI=@vger.kernel.org X-Gm-Message-State: AOJu0Yxw06SpDVJaCJb6aHbQw2XCrDLqukmpswtaYK5g3SR5fCk9UKBk as836KQ/RQe431+NeblavhifxYbcHV+RmIM8dKvqKGLRKVSlGvGedWkjKlZ0O6CT X-Gm-Gg: AR+sD11exzd/+3CZ3J2Yr+3dcgVOOAob5fKI8Jg2r+XCoJdVirayIXkJAO6utZRzwWD sPy1ZXBomqa5Rkws9IdZL2gSklV3dNh+4ffn3MVthKEhSHJHXU+zS1yY2umYoVCiK5ihQYPyaQS ibczVMRKCgbzVi1BMwDwzy4Wtbt/QatglmQjMVZESdVv5Y0R6bt3kYbFKSyVnjrhDDehfhqTG1+ aty8Metm6ybNDzAaW+ERlmUwuIzsK9eNlpc6Vr0hCOKqBkdyS6Yf1KoTZN8prLpEggRMPI1Yvrm m4BIA8QArGCX3tVzB+xsv95sIsn0naEblj7AZcddTu9HK28ohu4lu24BWGVYZLpXF0vceb2YtHn Bcn7ybMhnkGHy9g6NC51RHQLN8BeIz38FReNRWKd0RoMPFDddX8fCH8Gml/t75xOYVi0fmHBOTA 5IhwezcM+Iy1yu/SGnxhocEb+XTPA1g2Yq/aax+2s2+3ZbloWh0/VMmKDi X-Received: by 2002:a17:90b:184b:b0:37f:eafd:3505 with SMTP id 98e67ed59e1d1-3933b74d94dmr34374872a91.6.1787016588143; Mon, 17 Aug 2026 18:29:48 -0700 (PDT) Received: from 192.168.1.6 ([140.213.202.182]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141530442c1sm9748744c88.2.2026.08.17.18.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 18:29:47 -0700 (PDT) From: Foxie Flakey X-Google-Original-From: Foxie Flakey Date: Tue, 18 Aug 2026 08:29:43 +0700 (WIB) To: Andrew Morton cc: Foxie Flakey , rppt@kernel.org, peterx@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] userfaultfd: reset err to be 0 when move_pages_ptes succeeded In-Reply-To: <20260817153501.ee2ee77976e1cd5b1e1c813b@linux-foundation.org> Message-ID: <05cd197e-da6b-1c90-fc26-315f273e6663@gmail.com> References: <9c936a9f-ed27-e510-872f-5b3b8c680975@gmail.com> <20260817152605.5d2bee3fbf1a2bace4c0eff1@linux-foundation.org> <20260817153501.ee2ee77976e1cd5b1e1c813b@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=US-ASCII On Mon, 17 Aug 2026, Andrew Morton wrote: > On Mon, 17 Aug 2026 15:26:05 -0700 Andrew Morton wrote: > > > > That behaviour manifested into this at userspace > > > > > > Source: [ .. unmapped .. ][ .. mapped ..] > > > Destination: [ .. mapped .. ][ .. unmapped ..] > > > ^ ^ > > > \ Kernel moved this far in actuality > > > What is reported to userspace on struct > > > uffdio_move's move field > > > > > > When the previous behaviour is > > > Source: [ .. unmapped .. ][ .. mapped ..] > > > Destination: [ .. mapped .. ][ .. unmapped ..] > > > ^ > > > Reported to user space via uffdio_move's > > > move field > > Also... > > I assume the above illuminates lack of coverage in the uffd selftests. > Is it hard to add a case to detect this? > Yes, I do have self contained reproduer test but there an issue. The issues I have is: 1. Its only appear when system is under memory pressure and is swapping. To create enough pressure what work atleast under my test environment, is to run many reproduer till the test system overloaded with memory (No, its not just "dd if=/dev/zero of=/tmp/garbage.bin", that doesn't work reliably from what I have tried). 2. It cannot detect if the problem is fixed, because it ran forever. What I have thought is somehow rig function move_pages() called that performs the actual move (which are move_pages_ptes() and I think move_splits_huge_pmd() too) to fail with -EAGAIN on first call and succeds after that. About memory pressure, I figure it has to be related with memory pressure as VM that is not actively swapping, I cannot reproduce the issue at all no matter how long I ran it. My hypothesis more less (from my limited experience in Linux internals + personal osdev), swapping likely causes move_pages_ptes() to fail temporarily due some pages are evicted to swap till they moved back to be resident in memory. For information my test VM configuration is: Distro: Ubuntu Server 24.04 CPU: 2 cores of AMD Ryzen 3 4300U RAM: 2 GiB (the lower the best) Storage: 8 GiB Kernels tested: Linux 6.8.0-137-generic -> Unreproduceable (the stock kernel came with Ubuntu 24.04 which is reason why I used this particular version) These kernel came from https://kernel.ubuntu.com/mainline/ Linux 6.16.0-061600-generic -> Unreproduceable Linux 6.17.0-061700-generic -> Unreproduceable Linux 6.19.0-061900-generic -> Reproducable Linux 7.1.0-070100-generic -> Reproducable Linux 7.2.0-070200rc5-generic -> Reproduceable