From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21934C7115C for ; Fri, 20 Jun 2025 17:21:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A865C6B008A; Fri, 20 Jun 2025 13:21:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A57156B008C; Fri, 20 Jun 2025 13:21:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9947A6B0092; Fri, 20 Jun 2025 13:21:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 896B16B008A for ; Fri, 20 Jun 2025 13:21:14 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2B4F6140BD2 for ; Fri, 20 Jun 2025 17:21:14 +0000 (UTC) X-FDA: 83576444868.19.C779250 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf08.hostedemail.com (Postfix) with ESMTP id 78DCD160007 for ; Fri, 20 Jun 2025 17:21:12 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r5lbiMfD; spf=pass (imf08.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750440072; a=rsa-sha256; cv=none; b=6SrqIFGfxbt3wtxPUIX+0JJZhf31QqSYvPI+foegjkdq40i4H8UDSYxxjr3t9asSEIBmUV 93XufNpaJvoT5+66NsDaaiVVwyDXvr12QUOBW9gFtjromKY1NqLyJwRQ5y4Kqqx/dfxsqD TtaLVqFBQZA1lMz1Mr8CgTSWSpH4IFc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=r5lbiMfD; spf=pass (imf08.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750440072; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fMADbmU37pMQvE+3vV6wApiDHz/pYig7R8U4y2jTjIU=; b=Wfp4Bdj6yTXyWcQZ9SGA00k80gVcv54cewDt4iRi6gfxAmnmMFHPbfS9MTJOVx6JdbHTNd s5Q2vUXhXhhFO7dUWePxGd0e/IuFbfGtQSqiQBHOyGcDFJckhNuRGoGPQ3SZJ8C/5GR3kM vFBxkUnHW3JNLkySoFqHqPgXGDJdxtE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AD0CAA52B78; Fri, 20 Jun 2025 17:21:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A7BC4CEE3; Fri, 20 Jun 2025 17:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750440071; bh=t6w5g9PHHJ0JICEUNKNQrpwD7Yaeo4JQujpqVDAF6tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5lbiMfDny1QstFlimSGvFGFtKmO3FDPV+hWhclfVN7fGQbsgtAsjr9LewoakZQlI db51yK6ywvkHkjxmPktB8ChBw8oXPZmYF1RVXes/KgiG8p9nqKMNrj5TA248S27zYg z5xr0Fxa4Uu+CXhm2ip8Y3ICqrmHX/0Kc92469agpxveDCO6JgYiqO+GWnCZDc901Z 0ln5VdxSoxY+24cuXux7qDbJwATtBto7Y9TNOJLR1RD7U2KJUHPmBVJYl6FDCZYGH7 Qw0d6h52zz6hXR+1wP1gWcpeHWstYP+iIgzg/YRojeIXwgeoIoT6TqpkB1kbuPNYop XcQtg7MfAPK0w== From: SeongJae Park To: Lorenzo Stoakes Cc: SeongJae Park , Andrew Morton , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lance Yang , Suren Baghdasaryan Subject: Re: [PATCH v2 0/5] madvise cleanup Date: Fri, 20 Jun 2025 10:21:08 -0700 Message-Id: <20250620172108.95944-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 78DCD160007 X-Stat-Signature: 5fkju6p5ue95dwr564z4ym9ef8w46tcj X-Rspam-User: X-HE-Tag: 1750440072-42673 X-HE-Meta: U2FsdGVkX192wVkZp4wjbvS4GqDYMwFwWuA/5qas/ajKzE69fljQ4/oM7+xxYMIsen/TcFXhOizN+MQF+ITR8EE8f71Y+K4C66VIcTR/1mlwYdcQhzatM9zDqAaSAjo/a83zGPWWkBRkQwfxVNXqU3375FAPaazUrnbU6RjlRg/WHdD0vAW3aCwJUPb5y6x/9oLqTaHs8PTbCYiMZKKSmA07OLlFxzroiIVcaf+TeSz1CDYIDuXAPQsbb96wtoWHBbUqMchokRzdRJzHWz90tOABcq8GthSVaU5b4qxq3K3m6JHeBjN2L7mtYydSglBixqu4otA4qbC2mG8QLm2dC7AK0wU/Ijc5Ho9Pon2Zp89IkRhnH9eTIriSf4sYit8s/YAuzOMij9y0asLc+ZA8GXwhFc8cMKXsRrSc87Xli5sxf13wsZRuAnpdQIXdnQ2KRBTOGzdASNVH3kglIYpq0yAAtN4fnISG2h/Oa0s5V+h+Y/GJuowJsrtG39yhoQvB4HsLSMVk3LGQXGHNqOAA5tXY6TSUmezaes4dyck/y4KNg7HSaVutIlQLXJpck4TL071ZXSV76Im0zVi+GWTJSfk3ldRw4INu5pKv4RK+iVaFGO2zPVz6VA3PMRDqDZxt3LQ2ZiPxVK1i/ZQaNHBTDYWP0cgeajrTycXHADenNLoLsSkNz/R+E8FOD/Bh2CiTzlJI6NVANKB97iOq+D4i3IJJozK4k043AH+Kl734Ou+fFlN8O29s5L2k/tkNNg6bFhkn6umQg7aeqYTh2ZGw16P2RizSWVir8uogakrYL4IcpSymUb7FqAo6mZLx0nYW0YBvefuxALmrm27eIesLaE7gNiqnFnxxZyYpYC9BD7J3Fn3+SJvF6FsTXUg8lcqRp7PKxRylYy1p3KCLeMQOhdZSXTEKFGUKrDCNjSWNCd6d2WRNHXXVkcDn/dmnOZaKnZ9BR5XdDOQ7ggy0rb2 bbmBoe3S jaa+XcPmEA8HY7wuQrXx/7MgmD7qjO/4KdHQ7srkWnW3Xw0SmMENYucUushvGZBikK9JJQJI+v1w89+doVWpohTBnyPhoyAA5JwDBCETbrBJeXJDHQvBVzcO99Dcz8s0zLxwCCGN9R+Fey0pzw5SUlflrO8BuQLP7uC4O1M2yvtousAz+I1uAI9ijEvnFQsRDo7gF0M0HIj7GqTEUwQyfu4UNCWUdlidqMZJif2oa5YfI8kk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, 20 Jun 2025 16:33:00 +0100 Lorenzo Stoakes wrote: > This is a series of patches that helps address a number of historic > problems in the madvise() implementation: > > * Eliminate the visitor pattern and having the code which is implemented > for both the anon_vma_name implementation and ordinary madvise() > operations use the same madvise_vma_behavior() implementation. > > * Thread state through the madvise_behavior state object - this object, > very usefully introduced by SJ, is already used to transmit state through > operations. This series extends this by having all madvise() operations > use this, including anon_vma_name. > > * Thread range, VMA state through madvise_behavior - This helps avoid a lot > of the confusing code around range and VMA state and again keeps things > consistent and with a single 'source of truth'. > > * Addressing the very strange behaviour around the passed around struct > vm_area_struct **prev pointer - all read-only users do absolutely nothing > with the prev pointer. The only function that uses it is > madvise_update_vma(), and in all cases prev is always reset to > VMA. > > Fix this by no longer having aything but madvise_update_vma() reference > prev, and having madvise_walk_vmas() update prev in each > instance. Additionally make it clear that the meaningful change in vma > state is when madvise_update_vma() potentially merges a VMA, so > explicitly retrieve the VMA in this case. > > * Update and clarify the madvise_walk_vmas() function - this is a source of > a great deal of confusion, so simplify, stop using prev = NULL to signify > that the mmap lock has been dropped (!) and make that explicit, and add > some comments to explain what's going on. > > v2: > * Propagated tags (thanks everyone!) > * Don't separate out __MADV_SET_ANON_VMA_NAME and __MADV_SET_CLEAR_VMA_NAME, FWIW. If this cover letter is added to the first patch, like Andrew usually does, as-is, checkpatch.pl may warn like below. WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) Obviously no real problem and I don't really care. I just found this since my tool (hkml) runs checkpatch.pl after adding the cover letter to the first patch, and hence this is just FWIW. Thanks, SJ [...]