From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8B4AA31D74C for ; Mon, 17 Nov 2025 14:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763389510; cv=none; b=YmxnDbVhObe3biAFs+LUPTER8wcYWO560D9yc+2lMGlNjjkjIN9ii6/DgGXD84rbrlRrrWiobG7TblApLJvGO3j0XDdxGb3lGbjwBw2/Y1Jrqm9Xi0jUKrtbeGpXKocVtfKWhKFoa+ey698G6Rli5ciYUNJeTs2Jc4yBZDMvnf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763389510; c=relaxed/simple; bh=1oClKF3XIx42GRgp2slE9G5qGbMG/nS/e7CJmqp78LY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CT0No0crv+Jq128bp34sWJLGbmk5bQAa5R09Tv/OK93mQgv7dvN5E5TECIZRhAowfCbGvRrxfkCcxFc+y8/wYSFyFNN/6xeu0USZpOr2WBBvHepaNjOZYT7Xs7IsIp8n2jFcapsa6If+5+1FdKgMQFNfKM0Cz+fN1xaRD7o/10w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c8Isrkiz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c8Isrkiz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40A24C116B1; Mon, 17 Nov 2025 14:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763389510; bh=1oClKF3XIx42GRgp2slE9G5qGbMG/nS/e7CJmqp78LY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=c8IsrkizjOj8dpvUcAu/mIW04zCRZ9ysG1beerNSeOC3U43y/0YVjnrzcKeCJyqLF D8BcRk8nfX8zxvbwcPQcW5vmpEipGc82w3h5+TCYJ6zpf4vD4Hd8JI7ZxKaINtwF4U lolyfp8taUpC7R9/JTdWyqN86jIIv2UU0w1+8JKqiHj6a+q4ueYP0D3BwwWZjgYZPV Lcj5NE7gRP1Ap23LmbzEg9m54agh4w3OpxYmXiBsP85lfSvOW5UyvDHsEjyTpisPrR btEaHdbXsKMlz49dhxv6tabHHCbZl81+zK+GC5fzcGNXz9Q6GRwtJBYkwQRMxC0f2U b+47gQs1Jp93Q== Message-ID: <069adbf6-181f-420f-b2b1-0ca22894d904@kernel.org> Date: Mon, 17 Nov 2025 15:25:05 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm: propagate VM_SOFTDIRTY on merge To: Lorenzo Stoakes , Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14.11.25 18:53, Lorenzo Stoakes wrote: > Currently we set VM_SOFTDIRTY when a new mapping is set up (whether by > establishing a new VMA, or via merge) as implemented in __mmap_complete() > and do_brk_flags(). > > However, when performing a merge of existing mappings such as when > performing mprotect(), we may lose the VM_SOFTDIRTY flag. > > This is because currently we simply ignore VM_SOFTDIRTY for the purposes of > merge, so one VMA may possess the flag and another not, and whichever > happens to be the target VMA will be the one upon which the merge is > performed which may or may not have VM_SOFTDIRTY set. > > Now we have the concept of 'sticky' VMA flags, let's make VM_SOFTDIRTY one > which solves this issue. > > Additionally update VMA userland tests to propagate changes. > > Suggested-by: Vlastimil Babka > Signed-off-by: Lorenzo Stoakes > --- Looks reasonable to me. I thought that we had that behavior in the past ... but I also remember scenarios where we would have imprecise soft-dirty handling. So I assume this was semi-broken for a while (soft-broken :) ) Acked-by: David Hildenbrand (Red Hat) -- Cheers David