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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63AB0C3F2D1 for ; Mon, 2 Mar 2020 17:35:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32A322146E for ; Mon, 2 Mar 2020 17:35:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32A322146E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA7CB6B0003; Mon, 2 Mar 2020 12:35:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B7EF06B0005; Mon, 2 Mar 2020 12:35:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABB906B0006; Mon, 2 Mar 2020 12:35:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 944576B0003 for ; Mon, 2 Mar 2020 12:35:20 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2E9D1180AD801 for ; Mon, 2 Mar 2020 17:35:20 +0000 (UTC) X-FDA: 76551123600.26.war26_4ba514781600b X-HE-Tag: war26_4ba514781600b X-Filterd-Recvd-Size: 3786 Received: from Galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Mar 2020 17:35:19 +0000 (UTC) Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1j8oyK-00069s-IK; Mon, 02 Mar 2020 18:35:16 +0100 Date: Mon, 2 Mar 2020 18:35:16 +0100 From: Sebastian Andrzej Siewior To: Vlastimil Babka Cc: linux-mm@kvack.org, Thomas Gleixner , Andrew Morton , Luis Chamberlain , Kees Cook , Iurii Zaikin , Mel Gorman , Linux API Subject: [PATCH v2] mm/compaction: Disable compact_unevictable_allowed on RT Message-ID: <20200302173516.iysuejilava37psk@linutronix.de> References: <20200115161035.893221-1-bigeasy@linutronix.de> <4cf4507b-0632-34e6-5985-df933559af9f@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <4cf4507b-0632-34e6-5985-df933559af9f@suse.cz> 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: Since commit 5bbe3547aa3ba ("mm: allow compaction of unevictable pages") it is allowed to examine mlocked pages and compact them by default. On -RT even minor pagefaults are problematic because it may take a few 100us to resolve them and until then the task is blocked. Make compact_unevictable_allowed =3D 0 default and RO on RT. Link: https://lore.kernel.org/linux-mm/20190710144138.qyn4tuttdq6h7kqx@linu= tronix.de/ Signed-off-by: Sebastian Andrzej Siewior --- v1=E2=80=A6v2: - Make the proc file RO instead removing it. - Mention this change in Documentation/=E2=80=A6/vm.rst. Documentation/admin-guide/sysctl/vm.rst | 1 + kernel/sysctl.c | 4 ++++ mm/compaction.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-= guide/sysctl/vm.rst index 64aeee1009cab..bbfa59d25eec3 100644 --- a/Documentation/admin-guide/sysctl/vm.rst +++ b/Documentation/admin-guide/sysctl/vm.rst @@ -128,6 +128,7 @@ allowed to examine the unevictable lru (mlocked pages) = for pages to compact. This should be used on systems where stalls for minor page faults are an acceptable trade for large contiguous free memory. Set to 0 to prevent compaction from moving pages that are unevictable. Default value is 1. +On CONFIG_PREEMPT_RT the default value is 0. =20 =20 dirty_background_bytes diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ad5b88a53c5a8..f113e31d0b0b6 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1483,7 +1483,11 @@ static struct ctl_table vm_table[] =3D { .procname =3D "compact_unevictable_allowed", .data =3D &sysctl_compact_unevictable_allowed, .maxlen =3D sizeof(int), +#ifdef CONFIG_PREEMPT_RT + .mode =3D 0444, +#else .mode =3D 0644, +#endif .proc_handler =3D proc_dointvec, .extra1 =3D SYSCTL_ZERO, .extra2 =3D SYSCTL_ONE, diff --git a/mm/compaction.c b/mm/compaction.c index 672d3c78c6abf..ba77809a1666e 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1590,7 +1590,11 @@ typedef enum { * Allow userspace to control policy on scanning the unevictable LRU for * compactable pages. */ +#ifdef CONFIG_PREEMPT_RT +int sysctl_compact_unevictable_allowed __read_mostly =3D 0; +#else int sysctl_compact_unevictable_allowed __read_mostly =3D 1; +#endif =20 static inline void update_fast_start_pfn(struct compact_control *cc, unsigned long pfn) --=20 2.25.1