From patchwork Mon Dec 3 08:01:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 10708719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A330113BF for ; Mon, 3 Dec 2018 08:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9835029289 for ; Mon, 3 Dec 2018 08:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95FD12ADA2; Mon, 3 Dec 2018 08:01:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 131952AD8B for ; Mon, 3 Dec 2018 08:01:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9BA96B6801; Mon, 3 Dec 2018 03:01:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A213C6B6802; Mon, 3 Dec 2018 03:01:25 -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 8EA236B6803; Mon, 3 Dec 2018 03:01:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 498AE6B6801 for ; Mon, 3 Dec 2018 03:01:25 -0500 (EST) Received: by mail-pl1-f197.google.com with SMTP id m1-v6so9635385plb.13 for ; Mon, 03 Dec 2018 00:01:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=kpSHdjsIpdnFrfWLr5GbhnM5za7atIDqubrwM25NgRs=; b=UYLwVumGPV+UNgDQbUPCctNioOgXvrawkWm5VQ/zOntMZTEfp76nhREt+ZP8MiAimF DCb2XrVidToJ3lePj1nWTaKGlV13SNX3OxCm/oHLGi7S3fvZN+myG2Zx11BWLNmEhhD4 RLqZyIWTsmCBhjysFws1Sl54gc0d2rrFDqsCbLTiLbrKmOdqBzzB9W9eVTdnztf9+fCr B0xcwVZL8frrG7NYcAd8/sV0KGHBwO/K9+4Ggba4FZQM7DjASsl6A+IJZ0sd5QtY/hsw cBRe84D20jIN1KiuQM5Jzf3xFPeBxq6kRjWv+vP24LfNPJY/fcnhxsJLqpCmaL6x+JfP em4g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: AA+aEWZrPp+lnhM7T+ck/do/SVXAlOhJ3PF3E1id1DOH/XnyoDNcjiqM fXZ2+yNFs2LCFy0r/jIIFMZGm5SgZftmlJR0cDi/d1kEzajx65TSslbPBkhNy3bS0YoC/yQCO8D mUf4wB4edlfW1xHZ2qUpz+niqvby6lrbzLdMnItfIPczEC7//w9xHle0skMNTtsnx8A== X-Received: by 2002:a17:902:2904:: with SMTP id g4mr14838361plb.39.1543824084901; Mon, 03 Dec 2018 00:01:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VXSpasKQc4H63RhZW/H0+tJR218CyGHgeTGTDG7tdwpVKFVNYpRf9r9PZXP6/r8knXkYCR X-Received: by 2002:a17:902:2904:: with SMTP id g4mr14838288plb.39.1543824083854; Mon, 03 Dec 2018 00:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543824083; cv=none; d=google.com; s=arc-20160816; b=SC7iF+7IA4jvKVLFTXKfBw2GfC9I1FfeU5Ifbpux5fXtODQLOA40IWwnsvJ0SmIrxg BBJWGzuNoHO5FYaAREciw/0M+zy33alS5OZ+Y3JN/3WEw+NjtJhbketcdxqCmfmz1hh7 OXmh4VAjcUOSfxhWR/SxYGj+g8zh8851QnAr2FbsO+1CjalMqvLKkoX5S0GEXD7Cf8it 3hovzwk9xaEpA7QXUzfZ3cAIBZSNOyl17Tx6xu9yaq2lHvitr5XfAQILVf9V3xW/61/R OvsXBhan1L+icx+eS1EwF66DBiabx5HGiYaIG/ls7V5PswZkoCbR5LkfQEJFospwef80 +Khw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=kpSHdjsIpdnFrfWLr5GbhnM5za7atIDqubrwM25NgRs=; b=VVXnBNyELhuahsr8HYccfRKAQhfZ40HIuoFhyyuY0G2QAD18pSc5nsFvZudz6vhIwc ayn6YWu5/j6T6EP8Ll4Rbmjy5auBGid3j69Y/oK0Gwxj03UZ3wD6+UE9ApYcPt0ifPnt OsmNVe+zv4PdaYwXopWh0rkX4CVe2C67yLcYyvRhdvxGsUn99mt17ctleQSfv5G328kU BeyiwmJ+RrcIL9U9rofN78OBbC0bZshaSoQBsW2ojtfARu+uHbYVpqAnOsnZPY5RnxOQ zRNw2oB5Ujpk+DBP2L9zHsdf8UJdrecIM8eawFIST4FZZ9bEqbyYw5Pal35Rg1KRkcvU /alw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com. [115.124.30.130]) by mx.google.com with ESMTPS id b10si14271752plz.233.2018.12.03.00.01.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 00:01:23 -0800 (PST) Received-SPF: pass (google.com: domain of xlpang@linux.alibaba.com designates 115.124.30.130 as permitted sender) client-ip=115.124.30.130; Authentication-Results: mx.google.com; spf=pass (google.com: domain of xlpang@linux.alibaba.com designates 115.124.30.130 as permitted sender) smtp.mailfrom=xlpang@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04428;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TEitRAJ_1543824080; Received: from localhost(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TEitRAJ_1543824080) by smtp.aliyun-inc.com(127.0.0.1); Mon, 03 Dec 2018 16:01:20 +0800 From: Xunlei Pang To: Michal Hocko , Roman Gushchin , Johannes Weiner Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/3] mm/vmscan: Enable kswapd to reclaim low-protected memory Date: Mon, 3 Dec 2018 16:01:18 +0800 Message-Id: <20181203080119.18989-2-xlpang@linux.alibaba.com> X-Mailer: git-send-email 2.14.4.44.g2045bb6 In-Reply-To: <20181203080119.18989-1-xlpang@linux.alibaba.com> References: <20181203080119.18989-1-xlpang@linux.alibaba.com> 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: X-Virus-Scanned: ClamAV using ClamSMTP There may be cgroup memory overcommitment, it will become even common in the future. Let's enable kswapd to reclaim low-protected memory in case of memory pressure, to mitigate the global direct reclaim pressures which could cause jitters to the response time of lantency-sensitive groups. Signed-off-by: Xunlei Pang --- mm/vmscan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 62ac0c488624..3d412eb91f73 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3531,6 +3531,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) count_vm_event(PAGEOUTRUN); +retry: do { unsigned long nr_reclaimed = sc.nr_reclaimed; bool raise_priority = true; @@ -3622,6 +3623,13 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) sc.priority--; } while (sc.priority >= 1); + if (!sc.nr_reclaimed && sc.memcg_low_skipped) { + sc.priority = DEF_PRIORITY; + sc.memcg_low_reclaim = 1; + sc.memcg_low_skipped = 0; + goto retry; + } + if (!sc.nr_reclaimed) pgdat->kswapd_failures++;