From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 5353D4A23 for ; Sat, 13 Dec 2025 08:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765612856; cv=none; b=DTAYeeOjBtMqPKDtAkRZC77QTGZjrMa7azA4iTwyFx0EoeKGJwvImTHoxo20LubJtSpOzwfSnaLUS1Epg9XzP8Ke4b9Cq/1cnkyoHmkMPVc1quMWx3g396wdeMFvTi6AgG5ebm3hociJncSO6hA0B8LYTcIPMCvVk2tyxarXGUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765612856; c=relaxed/simple; bh=kakJHZ2lxOABuc84HEYpUwvB3kPDkf6B0kMAKNFG/C8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ri2cN1a18fDirrLwswLlGFx6uDyqMPuBR+TYCmRAzQuZ6z6ZUE6dM6r/+7DnnqjUr2oiQEDBmhzUASiHVclBfVNsACl+uiTbviWxOW0YPL85YYumW6Lm0BrGJMHuJAcpGnHnYHiCBZjBMsAP/y60U+PXiHlbpI2WTugvYbBVREY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-29d7b8bd6b0so12561035ad.0 for ; Sat, 13 Dec 2025 00:00:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765612855; x=1766217655; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uwMoXNDgoraLN2s2u+sQU14RS7UZ7t31vygWf6FGxo8=; b=TYQiaxPIFDpt/vOj/7vZSuSxsqIXVXZfwk2cWyBnRIdXMGG+3FJD04XbyAdwaVIbSt +KHLGQ2nC7rAuLP+s3jQqzKJtUl4b6WDKOM5auRzCohL7bTbihTf5YHzQ/5Wj6y/Veik r7uy1rZ3HAYLRLqP0xNJjuJ+K2iRRLfKLvtYd9vX4syt9Doqkuc34GMlGSP+m7hML9r6 LpSofEBr7tznbpntlg7BEqu58QGKiSmV+pqj7qLNC53YUCgDHuebGqYfHezG4taNobIL IvlNL7fsNYnaBzdxo2m+sFUr55oaHSVa5nLRGa3O2StvXjZAAOXsVIMixg+pR9MdRdyG ioOg== X-Forwarded-Encrypted: i=1; AJvYcCUM5ttBcLfqE83U9B5jX5/bsA7gNMrWYnIlaeDvEqV5aI3sJpuR/Au9vPQK7ygZCd4CJc8tqRsIp804rxU=@vger.kernel.org X-Gm-Message-State: AOJu0Yzu3XPwZk1GBXUjSdqYvOFDl7TGaexCHflm3S3gpx9BLuB2CPcH N2bVHLD9y8QH27iEnPpXvH0hOG19SIOlboN6hjL3MDP3KGh5D0abVggg X-Gm-Gg: AY/fxX6C1wO6v0N7qXJNuP1B9r6LjqisWraRshalL//DnvEqYHbHB4S70VlwBkqNBpy +ZPyLwJfjmFWaQjKruPYRCCIG5kZNyQbknEYf17bB+/5xP88ZzPo8PweW0oV4pxQQcDHcdNy/w1 BXknLbCtzPx/GR8iNkjb6dyyA0qUBWgVDEyFae2t/jHfoiFm0lbdqZdRCcGn4tYI0TWd3/Ha0Yl jGfLtOwHyAyPKmlmRDynW39S2/X+7d6c0WCiyiV7dbPnl8up7cT+T+7MbcDINCQRv64gMBrafp9 gTgllS7t2A582oP3mYc2IdSwhi6gqasdUrodp81KYeAb/TIHpDmS9VZ+ewthGey9v3ctOQro8dd TM7xyLUiQRquQEIZImRGTPeYOCExtpjVLi9l19aejdIZupSimzwdG0CNv7RsfK4RwGOQdb4PdbU pMnC53KfQiR80G2aGYxa8XdneO/A== X-Google-Smtp-Source: AGHT+IH/JoAGIeWkbC5Ijwb4LT700SBRuvmuttOCUbTdCoNc0d7rgbi/92X8za8oyhtLlyVRSzlnrA== X-Received: by 2002:a17:903:1c3:b0:266:57f7:25f5 with SMTP id d9443c01a7336-29eeea041c6mr87005275ad.7.1765612854584; Sat, 13 Dec 2025 00:00:54 -0800 (PST) Received: from localhost.localdomain ([45.142.165.134]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29f05287fa3sm53149155ad.5.2025.12.13.00.00.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 13 Dec 2025 00:00:54 -0800 (PST) From: Lance Yang To: akpm@linux-foundation.org Cc: will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, arnd@arndb.de, david@kernel.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, ioworker0@gmail.com, shy828301@gmail.com, riel@surriel.com, jannh@google.com, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC 0/3] skip redundant TLB sync IPIs Date: Sat, 13 Dec 2025 16:00:22 +0800 Message-ID: <20251213080038.10917-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 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=y Content-Transfer-Encoding: 8bit Hi all, When unsharing hugetlb PMD page tables or collapsing pages in khugepaged, we send two IPIs: one for TLB invalidation, and another to synchronize with concurrent GUP-fast walkers. However, if the TLB flush already reaches all CPUs, the second IPI is redundant. GUP-fast runs with IRQs disabled, so when the TLB flush IPI completes, any concurrent GUP-fast must have finished. This series introduces a way for architectures to indicate their TLB flush already provides full synchronization, allowing the redundant IPI to be skipped. For now, the optimization is implemented for x86 first and applied to both hugetlb PMD unsharing and khugepaged. I will dig into other architectures later, and folks maintaining other architectures are welcome to help out. David Hildenbrand did the initial implementation. I just built on his work and relied on off-list discussions to push it further — thanks a lot David! Lance Yang (3): mm/tlb: allow architectures to skip redundant TLB sync IPIs x86/mm: implement redundant IPI elimination for PMD unsharing mm/khugepaged: skip redundant IPI in collapse_huge_page() arch/x86/include/asm/tlb.h | 17 ++++++++++++++++- include/asm-generic/tlb.h | 22 +++++++++++++++++++++- mm/khugepaged.c | 7 ++++++- 3 files changed, 43 insertions(+), 3 deletions(-) -- 2.49.0