From patchwork Mon Mar 2 17:35:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 11415921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8F8C930 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 85FCA222C4 for ; Mon, 2 Mar 2020 17:35:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85FCA222C4 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B7EF06B0005; Mon, 2 Mar 2020 12:35:20 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 2,0,0,6b218413740e65db,d41d8cd98f00b204,bigeasy@linutronix.de,,RULES_HIT:41:152:355:379:800:960:966:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1437:1513:1515:1516:1518:1519:1521:1534:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:1801:2196:2199:2393:2525:2553:2559:2563:2682:2685:2859:2902:2910:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4605:5007:6119:6261:7875:7903:9025:10004:10400:11026:11473:11658:11914:12043:12114:12160:12296:12297:12438:12555:12679:12895:12986:13895:14093:14096:14097:14181:14394:14721:21080:21451:21627:21749:21811:21939:21983:21990:30054:30070:30089:30090,0,RBL:193.142.43.55:@linutronix.de:.lbl8.mailshell.net-64.201.201.201 62.14.6.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none 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-Disposition: inline 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 = 0 default and RO on RT. Link: https://lore.kernel.org/linux-mm/20190710144138.qyn4tuttdq6h7kqx@linutronix.de/ Signed-off-by: Sebastian Andrzej Siewior --- v1…v2: - Make the proc file RO instead removing it. - Mention this change in Documentation/…/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. 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[] = { .procname = "compact_unevictable_allowed", .data = &sysctl_compact_unevictable_allowed, .maxlen = sizeof(int), +#ifdef CONFIG_PREEMPT_RT + .mode = 0444, +#else .mode = 0644, +#endif .proc_handler = proc_dointvec, .extra1 = SYSCTL_ZERO, .extra2 = 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 = 0; +#else int sysctl_compact_unevictable_allowed __read_mostly = 1; +#endif static inline void update_fast_start_pfn(struct compact_control *cc, unsigned long pfn)