From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 68F8733CE80 for ; Tue, 17 Feb 2026 17:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771350231; cv=none; b=pmJp84k9fJs7a6s1Ad32+rXYPic5uOyRyYQwzekQQ+ZF4aPABT437D5IY7YAdCPO3g0AgImFOxcEqd8q2Tfa7i6cm7BVRsm+7qDoYn4I6Z+IE8IFDln2TGMLVUxfrYtFj9Yx1xefmoLqWv3wAHFK4JXoAS+AQObjCGLywcV9c90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771350231; c=relaxed/simple; bh=fxnDOKcZWqdhd0Fcp08S6KU0D439WFy/tYwfxTYLDRE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ex7FN7KJMImMjm6BsUaNllURTR4Foe7ptEEE6H+b4cNk6+D3sha+ZYATKol3JOG4Xh029BuKi8ZAd/4k+RFTUt51LLxlSy1hVQucwGT3htuP0tdLI3O13ZN7AL+608WoYTYwzdABDWR/Y7kxzYocEXpa/qOvNVUCq1/0TQMkwRU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Aq0JOgpS; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Aq0JOgpS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771350229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=poXugDg94mqOoGIdahpQoY5scXHKHEeEHQyw1IJe2XU=; b=Aq0JOgpSDGByEITJ6Hy6686d0yYvxKbzKd/Uas2yKhUe7O1kLY6jiaDpRDVKm19S0lPAnN je1geQWLYiUnQafN2fNzq/UBMLbF7PlP1dDmaFcyR8oWO0LB5iv+5pGs0+X1p9WpsawRH7 8unnPYMwaun8opXKx81psLZnL5JzERA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-fNBTH5yiOvG_a6W2VSiR1g-1; Tue, 17 Feb 2026 12:43:43 -0500 X-MC-Unique: fNBTH5yiOvG_a6W2VSiR1g-1 X-Mimecast-MFC-AGG-ID: fNBTH5yiOvG_a6W2VSiR1g_1771350221 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4E02519560B2; Tue, 17 Feb 2026 17:43:40 +0000 (UTC) Received: from localhost (unknown [10.22.89.47]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B598130001A5; Tue, 17 Feb 2026 17:43:39 +0000 (UTC) Date: Tue, 17 Feb 2026 12:43:38 -0500 From: Luke Yang To: Dev Jain Cc: pfalcato@suse.de, david@kernel.org, surenb@google.com, jhladky@redhat.com, akpm@linux-foundation.org, Liam.Howlett@oracle.com, willy@infradead.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [REGRESSION] mm/mprotect: 2x+ slowdown for >=400KiB regions since PTE batching (cac1db8c3aad) Message-ID: References: <764792ea-6029-41d8-b079-5297ca62505a@kernel.org> <71fbee21-f1b4-4202-a790-5076850d8d00@arm.com> 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: <71fbee21-f1b4-4202-a790-5076850d8d00@arm.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On Mon, Feb 16, 2026 at 03:42:08PM +0530, Dev Jain wrote: > > On 13/02/26 10:56 pm, David Hildenbrand (Arm) wrote: > > On 2/13/26 18:16, Suren Baghdasaryan wrote: > >> On Fri, Feb 13, 2026 at 4:24 PM Pedro Falcato wrote: > >>> > >>> On Fri, Feb 13, 2026 at 04:47:29PM +0100, David Hildenbrand (Arm) wrote: > >>>> > >>>> Hi! > >>>> > >>>> > >>>> Micro-benchmark results are nice. But what is the real word impact? > >>>> IOW, why > >>>> should we care? > >>> > >>> Well, mprotect is widely used in thread spawning, code JITting, > >>> and even process startup. And we don't want to pay for a feature we can't > >>> even use (on x86). > >> > >> I agree. When I straced Android's zygote a while ago, mprotect() came > >> up #30 in the list of most frequently used syscalls and one of the > >> most used mm-related syscalls due to its use during process creation. > >> However, I don't know how often it's used on VMAs of size >=400KiB. > > > > See my point? :) If this is apparently so widespread then finding a real > > reproducer is likely not a problem. Otherwise it's just speculation. > > > > It would also be interesting to know whether the reproducer ran with any > > sort of mTHP enabled or not.  > > Yes. Luke, can you experiment with the following microbenchmark: > > https://pastebin.com/3hNtYirT > > and see if there is an optimization for pte-mapped 2M folios, before and > after the commit? > > (set transparent_hugepages/enabled=always, hugepages-2048Kb/enabled=always) ---------- amd-epyc2-rome # before commit $ uname -r 6.16.0-65.eln150.x86_64 # after commit $ uname -r 6.17.0-0.rc1.17.eln150.x86_64 $ cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never $ cat /sys/kernel/mm/transparent_hugepage/hugepages-2048kB/enabled [always] inherit madvise never Before commit: Total = 6895988972 After commit: Total = 2303697782 Percentage change: -66.6% ---------- amd-epyc3-milanx # before commit $ uname -r 6.16.0-65.eln150.x86_64 # after commit $ uname -r 6.17.0-0.rc1.17.eln150.x86_64 $ cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never $ cat /sys/kernel/mm/transparent_hugepage/hugepages-2048kB/enabled [always] inherit madvise never Before commit: Total = 4006750392 After commit: Total = 1497733191 Percentage change: -62.6% ---------- Luke