From patchwork Thu Jun 6 10:14:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10979149 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 EDF9D92A for ; Thu, 6 Jun 2019 10:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEE7F28607 for ; Thu, 6 Jun 2019 10:15:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F7E28784; Thu, 6 Jun 2019 10:15:21 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 70BF828872 for ; Thu, 6 Jun 2019 10:15:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32DAB6B0010; Thu, 6 Jun 2019 06:15:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2DDD66B0266; Thu, 6 Jun 2019 06:15:20 -0400 (EDT) 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 1F5A56B0269; Thu, 6 Jun 2019 06:15:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id DC4C76B0010 for ; Thu, 6 Jun 2019 06:15:19 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id f25so289292pfk.14 for ; Thu, 06 Jun 2019 03:15:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=iC7IvtN4NDCekairGwv/3Djq2q1362Qy2AwvFRN/5YY=; b=icTzxff4PhwlkRP/WKEKTIV5ixEcSQa8r8PYrHNUj2EWvUEZpY0PkCwGMCRnhMVFs0 tYvr79tcR2lELmPwQflU8XRwKgJUrlll9H/zUtTSGwjGq1dTt5H1G9Ju9WlGMIicl5ry SFShfm65pGehJbPDdUPUbiHNv6b8QgeQYFU3KIvaIaj7+0CsaW1UPwNO+vVZiFZ0ahZu ceqmaxC3PRubZ6Ip9+Qx+cSv2Jx3HBg8yQ66A1cKzDa8aKH/vSVsqDZ4nsVV2X62K338 jRx3rJuAflOX3Dqj0jez9WDYs3xYpyg7NNFIYVcKcWhwNQgfYmGDNJKs6zhEOda6wC35 qbZg== X-Gm-Message-State: APjAAAVfjGJyH49MBITVADY5awvKSJUG10Eu/ydNQHUtrJWANsP7mLR5 iv3Ygdste5kI1F60rxEK3ihlsCY26PVrLF23UvO0WVKd/E/mYwOPQ81WFm6x45MNtDUtQr0lKPN eTDfzaUZKMF3scSsxcWh7TTAzPJfL3xx8z2AMB8hhcbSQygqS6jKzjY42uGFdlfLFOw== X-Received: by 2002:a65:5304:: with SMTP id m4mr2655001pgq.126.1559816119185; Thu, 06 Jun 2019 03:15:19 -0700 (PDT) X-Received: by 2002:a65:5304:: with SMTP id m4mr2654903pgq.126.1559816118015; Thu, 06 Jun 2019 03:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559816118; cv=none; d=google.com; s=arc-20160816; b=EAAQvzXKoJHPXXSJVWU4QNlWzrXHIr+f/NTDjLncMsXr7WZcmG6KnW3OddbYoaOokD 16hk5htP73s6473IezBDjqT4euTJbV4JeibqbRBhiJiafylRQthI9MZYl617YpK2OkVL XM8LDLoyoRNDSNyj6xOFK6aKFDXG8vpvfnXjqwW4ZfNvaEGr9aus8aOI/ers9tT6bpoY ohwTD7zVUHeLTi/1FH8s7mQAuJpDVvlgWZslsWJPFQTEvz9iHLNZ+qDwY7n31KVJ2k9N i89SrMZfTkMK9w8p2FkgdIUS+kuINYUg7w/nFmHMtGFRdsw6Mqs58R5NsH7KNgZ4LQ2s AhYA== 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 :dkim-signature; bh=iC7IvtN4NDCekairGwv/3Djq2q1362Qy2AwvFRN/5YY=; b=g+XQ9LMNN94WEzx91TcBJ62IfPHXMKEhZQbWpx0dUatCHB0D5nVgiBmikQkAQ39ekP 24AiOQvzP1J+2AXdVCKAz5U+MDglDP4zJAhxQNB5Xzmn04EOVWdhfDM0a74wViPJkwqD z9/IXyxQA73JpoN155bDWSfy3qLf2gpNfahEE5wUhcgLT8cXQMHMre6lPe8Rqr6wwqhG Wj4sCqxEibMn82IBXfmtVUW+UXZrAEmbLw0vvO6+y3cs5r203RhArITyTKUsOAdtp0Ag GKFqIdE36YwGA+kYrfPWw5LKb/7JUfGEa803jRhxv5ULrxxch94NbhFRHNAPE86mZUsg Gtig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gMZWUftQ; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l10sor1409720plt.10.2019.06.06.03.15.17 for (Google Transport Security); Thu, 06 Jun 2019 03:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gMZWUftQ; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iC7IvtN4NDCekairGwv/3Djq2q1362Qy2AwvFRN/5YY=; b=gMZWUftQlfmpgzqStlcNNCulcRTf8QMFFt20jXwOLapLbmxkUrSmDWNSPVC7Amf7ni 3V+gjJ5tAEXTmkmvpyw63wliVPYrRZ3Ky8YyhPCrKlzAdJVFrCrF/uUCXyHuDeX5ScOF RuBp32EY6fq1CCye1kKTqf2hHOmd61Oxq4eibffL/nCuLcfqlDUsdZOvVO2oQaFgnbhm OXUOaeYl0ArW+9GtHpwCQGeqdX5YpIKNSO6yx6XHG7MpPJgt1BD8z5XLqTtv0d1L9t0T bZF8uYWtpK7+IpSa+CvWasIDyKyC54Dx9pJB69wOJ1HH5cQL20UyDNcTxhkHWKmUDyoz ry3g== X-Google-Smtp-Source: APXvYqzPQuNQCuseJiQ7kbmP2jXJ70zcwJGhguUmqchqJI3A3dfuByA/3XsAq2oLJkAOg1x/6RrJwA== X-Received: by 2002:a17:902:e85:: with SMTP id 5mr10506374plx.202.1559816117788; Thu, 06 Jun 2019 03:15:17 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id z68sm1895829pfb.37.2019.06.06.03.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 03:15:17 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, mhocko@suse.com, linux.bhar@gmail.com Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v4 1/3] mm/vmstat: expose min_slab_pages in /proc/zoneinfo Date: Thu, 6 Jun 2019 18:14:38 +0800 Message-Id: <1559816080-26405-2-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559816080-26405-1-git-send-email-laoar.shao@gmail.com> References: <1559816080-26405-1-git-send-email-laoar.shao@gmail.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 On one of our servers, we find the dentry is continuously growing without shrinking. We're not sure whether that is because reclaimable slab is still less than min_slab_pages. So if we expose min_slab_pages, it would be easy to compare. As we can set min_slab_ratio with sysctl, we should expose the effective in_slab_pages to user as well. That is same with min_unmapped_pages. Signed-off-by: Yafang Shao --- mm/vmstat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index fd7e16c..2e1c608 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1550,7 +1550,15 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, NR_VM_NUMA_STAT_ITEMS], node_page_state(pgdat, i)); } + +#ifdef CONFIG_NUMA + seq_printf(m, "\n %-12s %lu", "min_slab", + pgdat->min_slab_pages); + seq_printf(m, "\n %-12s %lu", "min_unmapped", + pgdat->min_unmapped_pages); +#endif } + seq_printf(m, "\n pages free %lu" "\n min %lu" From patchwork Thu Jun 6 10:14:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10979151 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 693BD14E5 for ; Thu, 6 Jun 2019 10:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 591FA28560 for ; Thu, 6 Jun 2019 10:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DB112886C; Thu, 6 Jun 2019 10:15: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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 487F5287AD for ; Thu, 6 Jun 2019 10:15:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01FC66B0269; Thu, 6 Jun 2019 06:15:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F13C56B026A; Thu, 6 Jun 2019 06:15:23 -0400 (EDT) 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 DB4946B026C; Thu, 6 Jun 2019 06:15:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id A34C76B0269 for ; Thu, 6 Jun 2019 06:15:23 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id l4so1530261pff.5 for ; Thu, 06 Jun 2019 03:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=8+IwF0335QNXDHgSaRi4xr3Z8UVNirnqsUP9wOtPXKs=; b=mfvSw1n+IlhWC+e7cpdap0Zwwu472eFIwhAbz1BgJMhMSZBABIjhA/wua009rFLeJy BzkL0Jnqtj0y/6MK3rOLExM83eTfys3sjN7LE2WvveCrkq/2W1tR8RRol18yl4nQzDPL dH24lCJEVYFLHDzY3QibTVPK06JwZO6ibJoFyM41ymJPpUbwNiMIrDxmzAnYlVJCvKQL 0f+hotcfEPk9k4ij8r6YUSDDesG39Wy3h7uCz/2cRgBz8R7CJURIg8otXib1FFd8Me4R FU1I8rg72uItVda+/F6LgnFT+LSXWgmBH1tiSns7BvFT2U7LL/slj2I7BJ7KE2mMPS2u M3IA== X-Gm-Message-State: APjAAAU4t54+BvRuWZqr6adIAvKV8ZEdVXYUGONoitivjL7xPF575xed xsl6vqINzZMxRjieYX4SK+oPl6LyOLz5pPfpmtUVuU1XanxE5+6doY0XONwnZO4nDkk41sYXzS9 6Iy6kEUYK+an5xYJ8EM3L7yK+homdtO7rQY/UAPivFkb9G9UgeUiaI+fUreQDGVISvw== X-Received: by 2002:a62:6844:: with SMTP id d65mr52706642pfc.175.1559816123118; Thu, 06 Jun 2019 03:15:23 -0700 (PDT) X-Received: by 2002:a62:6844:: with SMTP id d65mr52706559pfc.175.1559816122057; Thu, 06 Jun 2019 03:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559816122; cv=none; d=google.com; s=arc-20160816; b=QxbO7fT+g7PhE2Ex94+YCo5sJurxzqDGMBv4nXPi+OAC1GkRPnxtJ+a91AWqFNpmE9 WaHCcdhw6qym2xKJvKrSlqF02eCy7EDEOx4nBSnhGEOfsJw4wLFyGOMk5gH1HPjmEOIc tIhYKZGG9DszLaAbF8qT5KY/lqPb0zhpJb6gBJC4e9F1rf5Ux4VutmvW9v8gcVN3VncC Y3GZkgA4Nz9uwNCJmNIouCXZfqoaJ22GYO4tvbbATQ1bCEk9xmjGh5pIFnRVi/afhnJo RzbctiaitikJua/SDawPFMQ88fcB1RjzT9fyMlbstwuF1fTlYH2cFDOzCKy34fQcgtqp PiaQ== 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 :dkim-signature; bh=8+IwF0335QNXDHgSaRi4xr3Z8UVNirnqsUP9wOtPXKs=; b=ddEvN/Ru0w9tckFcovRDacqKoRqLKk9w5IZXuxVObEwG4HiqAzLnfAPMWuz9x3Iigb ecSXcrLKx81urKERlKQlS5NkPksnAIOpLuQjFemQE+nJ62skMIKAlVPDYIwbNX+SpGqG AHJ7epMvq8hHhThtAd/94BH8PHmaHrlQo3dX0sKUoTyTZPFRnFIdUHujGy4Tw7gWGEsH ELJTBqzvHfGVcB/IAuC+m1QJHHnvSf/2AE4pruwSP1DNsx3XV+AZ1h9EAqpux3hsDFsJ WVXy0PL88zn9xD4DQJ2Z4VBtRnE0ANnQnLZJtSVQLF9FZ9ai0kLuWVR+kGxVl3+q6hlh 1GXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jg3GgoVm; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u6sor1552099pjn.27.2019.06.06.03.15.21 for (Google Transport Security); Thu, 06 Jun 2019 03:15:22 -0700 (PDT) Received-SPF: pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jg3GgoVm; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8+IwF0335QNXDHgSaRi4xr3Z8UVNirnqsUP9wOtPXKs=; b=jg3GgoVmCY/bC92MYCfLgi6NuTGRDm/487IydZ68+fijsLV0d8QxsKpi3gevxG9MKv CStbLX6GcKQhMDuDtfH2TO6FMGyratyZUUmu1DDva5BTYrq8x2y9NwVtMKQL73uAMWb9 LZTVLPDSvrwDNly8FTs5U5LwOomGuOWQGaRAV0rXqIp1lbhDWLSAbs9/X0F3ZK4jyhYv w/BtCr89WltsywNUQu/KINBbhTtoHYQC/+5ymTZzu90d/5xhoSH4GhK0D7UbetwEhSjh kpNL2h1jmFzmo0NG6xoztwVGzFHhJRgQXkAyotG4Y7PRE9fQiVzVYYVALkY2IG8/7wOv vXGg== X-Google-Smtp-Source: APXvYqzG3+8/LzV9uQ9G3bjFjX0YqT5YWawQvI2XSVm68YYd7+NjikxYEiHsmbZD7zjSF9YXSvPNuA== X-Received: by 2002:a17:90a:364b:: with SMTP id s69mr52048168pjb.15.1559816121658; Thu, 06 Jun 2019 03:15:21 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id z68sm1895829pfb.37.2019.06.06.03.15.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 03:15:21 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, mhocko@suse.com, linux.bhar@gmail.com Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v4 2/3] mm/vmscan: change return type of shrink_node() to void Date: Thu, 6 Jun 2019 18:14:39 +0800 Message-Id: <1559816080-26405-3-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559816080-26405-1-git-send-email-laoar.shao@gmail.com> References: <1559816080-26405-1-git-send-email-laoar.shao@gmail.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 As the return value of shrink_node() isn't used by any callsites, we'd better change the return type of shrink_node() from static inline to void. Signed-off-by: Yafang Shao --- mm/vmscan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 84dcb65..281bfa9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2687,7 +2687,7 @@ static bool pgdat_memcg_congested(pg_data_t *pgdat, struct mem_cgroup *memcg) (memcg && memcg_congested(pgdat, memcg)); } -static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) +static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) { struct reclaim_state *reclaim_state = current->reclaim_state; unsigned long nr_reclaimed, nr_scanned; @@ -2857,8 +2857,6 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) */ if (reclaimable) pgdat->kswapd_failures = 0; - - return reclaimable; } /* From patchwork Thu Jun 6 10:14:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10979153 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 69CA014E5 for ; Thu, 6 Jun 2019 10:15:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AE6728784 for ; Thu, 6 Jun 2019 10:15:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F65D285EC; Thu, 6 Jun 2019 10:15:30 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 C0A4928866 for ; Thu, 6 Jun 2019 10:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ACFC06B026C; Thu, 6 Jun 2019 06:15:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A81616B026D; Thu, 6 Jun 2019 06:15:27 -0400 (EDT) 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 96FA16B026E; Thu, 6 Jun 2019 06:15:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 5FF2E6B026C for ; Thu, 6 Jun 2019 06:15:27 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id f25so289545pfk.14 for ; Thu, 06 Jun 2019 03:15:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=k0l9U+sWxSO3Dg0lLraseLlI8mAPkbXeLIQciOlURR0=; b=LPb6om+vsYgUQr/UcaQtscyBbkqxZ4qNkYb13Hh6u/yW4WvNoCpxIhO34CgKFkxmmn pH+xokmKsNz9HE6r99NuKnjgRrR56QQhNDC5U6rLBc/GTfjnmY5meV8h8VzHZ8GlFdpC FJMDDYxcG0eT9A63X6Jf7sCrWKJAvUj/bVKJHDdDqxrd2EXPM3D0IRCrOImpxF0ZwZwN z867SEAW2bq+A21vHi+5gMwIAdxt/Omsz8LL7INU8zJeWi0E5ghNyCGu+xeOOtKVg82D +lWgQNzW9tvNObVPGy5lAjk/w30FfC5MIsFBfJojPBloP+YTUR+mRjNtBDqG6oHgmeJ+ szCw== X-Gm-Message-State: APjAAAVgA5QE46VW6/kN20zf77eOcwkDU497wOxQmldXuAnnd1UswfTM 4O02yA2lh9AAGPnzmMQh6k/yc7dz7dkM5JCnj53AuvdBAjyfkE4S36TfQrICGMXFcSVPpU8OBCd qzOccD5SGxw0cHWzTDbrf5SLcCJl2VaEFBh3AHZWeZe939Sr/pjtWx8FDPrqnp3xnpw== X-Received: by 2002:a62:1c91:: with SMTP id c139mr44497973pfc.25.1559816126857; Thu, 06 Jun 2019 03:15:26 -0700 (PDT) X-Received: by 2002:a62:1c91:: with SMTP id c139mr44497858pfc.25.1559816125479; Thu, 06 Jun 2019 03:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559816125; cv=none; d=google.com; s=arc-20160816; b=wAi0MalDIkKcnOvgzYXeJu1gX15H6iaRBTPYV88qDW8Ag54h82xMIs9uoiB5D4OZqh 6ctyuxW9n9yVU9+BZGONNdSxmJwNz70MAUGF3bhqFRJ+m1qFj2z9yHl0ZtK/5NIvNd70 9sJCxDsLVaEHHG5umDX60rZGe5NQ6QbpRZtt0HPmhqJtSozEaB9I6vM/wSZYLtK18CFP 056yLFnKlk+ZSCNZfLB/zNU22NFuHwQKvMLDRFPwBHoTK2cJhQD3C/oWKVHN2sRifrFA 6O92xR2DdMNYeKyQ2bkrOjtQalWAASMvfgImJSt8lQ/FuN5ug6RZPOZokpTpY3b4ugC9 T7Og== 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 :dkim-signature; bh=k0l9U+sWxSO3Dg0lLraseLlI8mAPkbXeLIQciOlURR0=; b=x2fdUpRb745+Q0eGYOdEaY+FklJbPeBrA5Q+VFS/v1okHjygWrfDbFyZ1d2rVJe7PA bwgNWZpVYkTjg1mPH0V9AI+LC2DNQcgty+XFRtI2OUSYU5GChrZyerDj9Kjv6wSn1/vf ms6WJb1uluEMOnfJ09IANpmK7J1yjFQ/LMPdZjSqEAJpcFmg1KyUI5o6nYMgMqRRcxIU GH8H4jfv89zkrji2QvBMbE/z68ZGsBp/v+kY8IRyCbyoxQ6d1W/8vk+a4TkCq6GjDpyQ esMX7O2mMoqlZNFoKOJEta3J8bMOr8CcSyS8TZLUNwZtmP0rK5yMS78xFTGEsIpVmaTm o8lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JPQyxXmz; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h42sor1567018pjb.11.2019.06.06.03.15.25 for (Google Transport Security); Thu, 06 Jun 2019 03:15:25 -0700 (PDT) Received-SPF: pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JPQyxXmz; spf=pass (google.com: domain of laoar.shao@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k0l9U+sWxSO3Dg0lLraseLlI8mAPkbXeLIQciOlURR0=; b=JPQyxXmz5AbC2GN+uXwBGzE7FZj+CmKUQbLDzpB6sb+dr9rW1QUgr4TI6PMGB5DIkD BlVh9N81Eq/4WfLr6/KFiZnjNAvcPeJ0LnNjGTYPPfRlaa694QQr7r/KLn85QhtjEiy1 8m06CFjqkucMajYAAzNw5sFslhBQ1fDvgL2pLzu/zMKx4JqwEKWVl5Wd+PnRwHq8Rf96 vfZ8SEx5w3aMrUDmwSBgz1FgjFAUV3QT6SY9HiqRUy/hLDzXncf1oVK5Cv93AAO8bQ4r Pg8hmzfakIWvTM1Xexey2BjD7Cjpy1WCbqJuEyp/a541Sr0u0Uqy8TEZWrugv8drh8DS VjRw== X-Google-Smtp-Source: APXvYqxKvfL027icRD2xvrxUtq46Y+QT8HXaBU8Ay/gNybybqWmCWqULPJC+LJsPMh5RL/X5xkxInQ== X-Received: by 2002:a17:90a:2743:: with SMTP id o61mr36311591pje.59.1559816125195; Thu, 06 Jun 2019 03:15:25 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id z68sm1895829pfb.37.2019.06.06.03.15.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 03:15:24 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org, mhocko@suse.com, linux.bhar@gmail.com Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v4 3/3] mm/vmscan: shrink slab in node reclaim Date: Thu, 6 Jun 2019 18:14:40 +0800 Message-Id: <1559816080-26405-4-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1559816080-26405-1-git-send-email-laoar.shao@gmail.com> References: <1559816080-26405-1-git-send-email-laoar.shao@gmail.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 In the node reclaim, may_shrinkslab is 0 by default, hence shrink_slab will never be performed in it. While shrik_slab should be performed if the relcaimable slab is over min slab limit. If reclaimable pagecache is less than min_unmapped_pages while reclaimable slab is greater than min_slab_pages, we only shrink slab. Otherwise the min_unmapped_pages will be useless under this condition. A new bitmask no_pagecache is introduced in scan_control for this purpose, which is 0 by default. reclaim_state.reclaimed_slab will tell us how many pages are reclaimed in shrink slab. This issue is very easy to produce, first you continuously cat a random non-exist file to produce more and more dentry, then you read big file to produce page cache. And finally you will find that the denty will never be shrunk in node reclaim. Signed-off-by: Yafang Shao --- mm/vmscan.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 281bfa9..da53ed6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -91,6 +91,9 @@ struct scan_control { /* e.g. boosted watermark reclaim leaves slabs alone */ unsigned int may_shrinkslab:1; + /* in node relcaim mode, we may shrink slab only */ + unsigned int no_pagecache:1; + /* * Cgroups are not reclaimed below their configured memory.low, * unless we threaten to OOM. If any cgroups are skipped due to @@ -2744,7 +2747,9 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) reclaimed = sc->nr_reclaimed; scanned = sc->nr_scanned; - shrink_node_memcg(pgdat, memcg, sc); + + if (!sc->no_pagecache) + shrink_node_memcg(pgdat, memcg, sc); if (sc->may_shrinkslab) { shrink_slab(sc->gfp_mask, pgdat->node_id, @@ -4176,6 +4181,10 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in .may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE), .may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP), .may_swap = 1, + .may_shrinkslab = (node_page_state(pgdat, NR_SLAB_RECLAIMABLE) > + pgdat->min_slab_pages), + .no_pagecache = !(node_pagecache_reclaimable(pgdat) > + pgdat->min_unmapped_pages), .reclaim_idx = gfp_zone(gfp_mask), }; @@ -4194,15 +4203,13 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in reclaim_state.reclaimed_slab = 0; p->reclaim_state = &reclaim_state; - if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages) { - /* - * Free memory by calling shrink node with increasing - * priorities until we have enough memory freed. - */ - do { - shrink_node(pgdat, &sc); - } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0); - } + /* + * Free memory by calling shrink node with increasing + * priorities until we have enough memory freed. + */ + do { + shrink_node(pgdat, &sc); + } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0); p->reclaim_state = NULL; current->flags &= ~PF_SWAPWRITE;