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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B6D4C433F5 for ; Wed, 27 Oct 2021 09:12:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0639560551 for ; Wed, 27 Oct 2021 09:12:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0639560551 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7211E940008; Wed, 27 Oct 2021 05:12:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D0D2940007; Wed, 27 Oct 2021 05:12:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BFD2940008; Wed, 27 Oct 2021 05:12:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 49DD8940007 for ; Wed, 27 Oct 2021 05:12:16 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E663D2C580 for ; Wed, 27 Oct 2021 09:12:15 +0000 (UTC) X-FDA: 78741651030.40.5EC410F Received: from outbound-smtp26.blacknight.com (outbound-smtp26.blacknight.com [81.17.249.194]) by imf10.hostedemail.com (Postfix) with ESMTP id 462756001991 for ; Wed, 27 Oct 2021 09:12:08 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp26.blacknight.com (Postfix) with ESMTPS id 0B9B1CABC6 for ; Wed, 27 Oct 2021 10:12:14 +0100 (IST) Received: (qmail 2008 invoked from network); 27 Oct 2021 09:12:13 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 27 Oct 2021 09:12:13 -0000 Date: Wed, 27 Oct 2021 10:12:12 +0100 From: Mel Gorman To: Sebastian Andrzej Siewior Cc: linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Peter Zijlstra , Thomas Gleixner Subject: Re: [RFC] mm: Disable NUMA_BALANCING_DEFAULT_ENABLED and TRANSPARENT_HUGEPAGE on PREEMPT_RT Message-ID: <20211027091212.GP3959@techsingularity.net> References: <20211026165100.ahz5bkx44lrrw5pt@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20211026165100.ahz5bkx44lrrw5pt@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: yzfw4gcq68e797fajqudhgwy48tttz6r Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.194 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 462756001991 X-HE-Tag: 1635325928-683396 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: On Tue, Oct 26, 2021 at 06:51:00PM +0200, Sebastian Andrzej Siewior wrote: > In https://lore.kernel.org/all/20200304091159.GN3818@techsingularity.net/ > Mel wrote: > > | While I ack'd this, an RT application using THP is playing with fire, > | I know the RT extension for SLE explicitly disables it from being enabled > | at kernel config time. At minimum the critical regions should be mlocked > | followed by prctl to disable future THP faults that are non-deterministic, > | both from an allocation point of view, and a TLB access point of view. It's > | still reasonable to expect a smaller TLB reach for huge pages than > | base pages. > > With TRANSPARENT_HUGEPAGE enabled I haven't seen spikes > 100us > in cyclictest. I did have mlock_all() enabled but nothing else. > PR_SET_THP_DISABLE remained unchanged (enabled). Is there anything to > stress this to be sure or is mlock_all() enough to do THP but leave the > mlock() applications alone? > > Then Mel continued with: > > | It's a similar hazard with NUMA balancing, an RT application should either > | disable balancing globally or set a memory policy that forces it to be > | ignored. They should be doing this anyway to avoid non-deterministic > | memory access costs due to NUMA artifacts but it wouldn't surprise me > | if some applications got it wrong. > > Usually (often) RT applications are pinned. I would assume that on > bigger box the RT tasks are at least pinned to a node. How bad can this > get in worst case? cyclictest pins every thread to CPU. I could remove > this for testing. What would be a good test to push this to its limit? > > Cc: Mel Gorman > Signed-off-by: Sebastian Andrzej Siewior Somewhat tentative but Acked-by: Mel Gorman It's tentative because NUMA Balancing gets default disabled on PREEMPT_RT but it's still possible to enable where as THP is disabled entirely and can never be enabled. This is a little inconsistent and it would be preferable that they match either by disabling NUMA_BALANCING entirely or forbidding TRANSPARENT_HUGEPAGE_ALWAYS && PREEMPT_RT. I'm ok with either. There is the possibility that an RT application could use THP safely by using madvise() and mlock(). That way, THP is available but only if an application has explicit knowledge of THP and smart enough to do it only during the initialisation phase with diff --git a/mm/Kconfig b/mm/Kconfig index d16ba9249bc5..d6ccca216028 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -393,6 +393,7 @@ choice config TRANSPARENT_HUGEPAGE_ALWAYS bool "always" + depends on !PREEMPT_RT help Enabling Transparent Hugepage always, can increase the memory footprint of applications without a guaranteed There is the slight caveat that even then THP can have inconsistent latencies if it has a split THP with separate entries for base and huge pages. The responsibility would be on the person deploying the application to ensure a platform was suitable for both RT and using huge pages. -- Mel Gorman SUSE Labs