From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AAED1364EAA for ; Sun, 5 Jul 2026 08:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783238402; cv=none; b=TtKOaXNw6yEVO8m7N+u0t8KxuF7JgzV4dpK78mwSnCmiutgredcSMAsii3f/wLSAkab8odRnAWxteo5WAdiNfwcPkwww6QvcIWI/KfypJXkONDvZoWBzfhzBjcgy6jYAodHLfOdoRGY2qWHnaqqETcD5E0jpe7i0Zv4xiEpLueI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783238402; c=relaxed/simple; bh=Eyn8+1pLp8CgvX90W8435WViIAGXQLGae8jXVVYSuh0=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=XsCA22eqZWe61cJTfOutW8stK7/mxMUNDAtEedvy5d+5U1jLnWUA9S/x0tYZGSYcg+f1VtA5Zs1iJifXTgKMWe9xEm+I7n7xsZLHtRD4a6kqd2+jHBuH1pAy4xg1nJBai8/L4zklOeIwI5klee6AHDiB8xvt/hdNWBodqHiDkqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Bw38b5kf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Bw38b5kf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D14AA1F000E9; Sun, 5 Jul 2026 08:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783238401; bh=C+RTSHxP2vSyd8onNRfos1htOyq8aCrQfwRYWC8rhv0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Bw38b5kfGJ8hqmEOgHH5FNV548X9MkggalAx/zMvWpGcRMxJXJS+4pY+NUARg01n7 +cNe5svEU3+SAubK2jGKIc7Me7FJD2vjPl9yhIJaD9RUVCcDMvKKlpb6RQfiXDdC6y hLI3tSr/Pv2BUlcgxas/bWu7AzTABrzdeHsliiiU= Date: Sun, 5 Jul 2026 01:00:00 -0700 From: Andrew Morton To: Cc: , , , , , , Subject: Re: [PATCH v11 =?UTF-8?B?MC8zXcKgS1NNOg==?= performance optimizations for rmap_walk_ksm Message-Id: <20260705010000.1f9b63735aa19fbfb5d9c24f@linux-foundation.org> In-Reply-To: <20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn> References: <20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 8bit On Fri, 3 Jul 2026 16:22:53 +0800 (CST) wrote: > This series fixes a severe KSM reverse-mapping performance problem > that can freeze applications for hundreds of milliseconds under > memory pressure especially when a lot of unrelated VMAs sharing a > single anon_vma. > > Two key highlights: > > 1. Lock hold time drops from >500ms to <2ms > - In our benchmark (20,000 VMAs sharing an anon_vma), worst-case > anon_vma lock hold time during KSM rmap walk went from 705ms > down to 1.67ms (max) and 1.44ms (avg). > > 2. Real user impact > - The anon_vma lock is also acquired by page faults, reclaim, > migration, compaction, mlock, exit_mmap, and cgroup accounting. > > - A long hold due to inefficient rmap walks stalls application > threads, causing latency spikes, reduced throughput, or even > container timeouts. > > - The problem occurs even without fork() – VMA splitting (e.g., > via mprotect or madvise over time) can create tens of thousands > of VMAs all attached to the same anon_vma. > > Real-world examples: Again, thanks for persisting with this. Great improvement and I'd love to see us get this finished off. Please have a look through the AI review: https://sashiko.dev/#/patchset/20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn That 32-bit thing looks legit, kinda fatal but easy to address.