From patchwork Mon May 27 11:52:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10962679 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 36D731390 for ; Mon, 27 May 2019 11:53:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2652928B21 for ; Mon, 27 May 2019 11:53:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A78628B24; Mon, 27 May 2019 11:53:24 +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 A5DAB28B22 for ; Mon, 27 May 2019 11:53:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B35486B0274; Mon, 27 May 2019 07:53:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AE5D26B0276; Mon, 27 May 2019 07:53:22 -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 9D6096B0277; Mon, 27 May 2019 07:53:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 6475E6B0274 for ; Mon, 27 May 2019 07:53:22 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id s195so1968171pgs.13 for ; Mon, 27 May 2019 04:53:22 -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=H6pwDfurTwvymXFL+GjiNLQ/ZlmPmWdTfSv7esEAkNY=; b=d5YLlCSOeCJr5dwjTVNc0c9xuTfOgnRmCoT1zoXFz1P2f0RHKPvLmkw9tu0ssTzxXJ xdBmJQkbmDtlyaT7diPJxQN4u7neFJDApqE2exP5rdIlyG/sD6eJX+13giuWmkSBLPzo lNFs4cCgNxH4SZh4PPut/jgLEPd05bV0iTwsqqmkKOZV5syD0xegUxmzY3FWdFUWQDPv HZpWgVN630UmK5cLAlCVBvfB+SJZPrgtCTm5WJEmYstQZ8FsbZpu2kG3vGryLAMN892r K5gcz1X9/PA6nLQcg8n5llVfEKeT6iltIiwFE2HBTR+a1T3Jb+3FsBZxzxun910jFxEY FLcQ== X-Gm-Message-State: APjAAAWWYM+OxjS51AChOAaIrR1/y9NHbc3mpZku1EGkvzcnkTUfsRh7 Iv2NR8nSie51mi8KzC+Z2GWjNIH7A8iNyXQtCWsrPBI6SLMa1kw/iPTxuGygpXIi1FQ37AMw9mW Z263+iM/kpXeSMM13/TO3lYXhXXk5ls0yFmU/ZFtIet2JTJT7EFhk15FVCLgkUyIMlA== X-Received: by 2002:a62:2f87:: with SMTP id v129mr63103855pfv.9.1558958002067; Mon, 27 May 2019 04:53:22 -0700 (PDT) X-Received: by 2002:a62:2f87:: with SMTP id v129mr63103794pfv.9.1558958001192; Mon, 27 May 2019 04:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558958001; cv=none; d=google.com; s=arc-20160816; b=e70oJZQUomwDdkQ3dNH0evF9+/Naf993Wd5Wv6NuWsP34tEhFdgZVfIQk39swWwV6k ZIvsghTVQBIjFHnAyxwYcyhmc5TFdVnVoFU7lkuhAjO3oFlic7S/OdYDrezTZJ0lJMxf XCiGEvJ562Y1JOs9+iWxl0oBeT7HdIQqF+yxeqIvunOFRFgyWtZ8I0b3ykTWlhBpT41B 4bXcST1tXBc7OaeYNzuCrIHUBjubZTGH2FkvMejv1GK5zZbtp4a2ML4mv3jE4/bXfIyi LrpQzTvdzLaSxox06StYsY7GVY1rmkRILLAjzhB6CKhPE3BFtyToRrxgPWCPuyuBmfXJ GSQg== 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=H6pwDfurTwvymXFL+GjiNLQ/ZlmPmWdTfSv7esEAkNY=; b=HyM0lqele2itxms1VtZ78mnkgGTUsvixCdLP7PeuRR9t9qNFSmbLeG3wmUqVvbZXlB u0EMu4MTT4fvl1IKWL0ldusj8/uoSNMVTUNL8RZLCXyn6pjwq+70BTPDs+t5SkGcFRzF o5lNtv+TzTvNU+TIubMqACB2cTHkD8hhaIEmQPylckPN4C6i5TKuT9vnvwiGJgZzCCXR Qx06e8Tu1tEq/5DfNR0hOYZAAwgi7DFcFp28Sm+gjqempj3JfcVxI6LUtSeFLeUOYkcM mBBu5ki8BcHzqCZS6pFrM4Xj+B3TF3HjTpuazqTDYTP4NjHI+lD3Jih63GpMlgrYS+lO jGmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gwhl6Uyd; 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 t32sor6497219pgm.70.2019.05.27.04.53.21 for (Google Transport Security); Mon, 27 May 2019 04:53:21 -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=Gwhl6Uyd; 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=H6pwDfurTwvymXFL+GjiNLQ/ZlmPmWdTfSv7esEAkNY=; b=Gwhl6UydUlKku/Zlw1lQSTiLSE/e98mws+wTcdKE/kaRNc88tiWPBk5wU/GKMuWU+Y 9DT0c5USFh8LtLrcNMeJaBKwc2zdUKMgoQR0jcGrXOIGvlNqkfBbQST+HTt3taNRQJ8X FRFWBlDB92VrCFN1FgIcIVI8ipSHe6KOdz1JDwocpkAL6/csfFn3K2YhFm1YbWbq2XHc vZgcpHPBa9qXfi7Kv0DL9lalMPjz/uSChRVfAyp59giyxHZsjQoMpms4CUcqKjYTiY6r gzXSjNvYt8g2dSBzeXdjEsgyB/T6o3eAq2q2BLNOuOPna0bAjUC/SMEwWU3oSkvY5fiy 3yxQ== X-Google-Smtp-Source: APXvYqw6Yd2DOEHsp8jed4XQtl8xX+zGbjN4PxPFczeHI+r4qoT7Kj7vIKYyux6vLntpg7Mjg6X4Uw== X-Received: by 2002:a65:51cb:: with SMTP id i11mr34733872pgq.390.1558958000941; Mon, 27 May 2019 04:53:20 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id e24sm9797738pgl.94.2019.05.27.04.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 04:53:20 -0700 (PDT) From: Yafang Shao To: mhocko@suse.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v2 1/3] mm/vmstat: expose min_slab_pages in /proc/zoneinfo Date: Mon, 27 May 2019 19:52:52 +0800 Message-Id: <1558957974-23341-2-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558957974-23341-1-git-send-email-laoar.shao@gmail.com> References: <1558957974-23341-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 min_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 a7d4933..bb76cfe 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1549,7 +1549,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 Mon May 27 11:52:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10962683 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 0DE871395 for ; Mon, 27 May 2019 11:53:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2AF528B20 for ; Mon, 27 May 2019 11:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E73D628B24; Mon, 27 May 2019 11:53: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 8D68A28B20 for ; Mon, 27 May 2019 11:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 568886B0277; Mon, 27 May 2019 07:53:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 519166B0278; Mon, 27 May 2019 07:53:26 -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 3BAFB6B0279; Mon, 27 May 2019 07:53:26 -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 022846B0277 for ; Mon, 27 May 2019 07:53:26 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id 11so13209532pfb.4 for ; Mon, 27 May 2019 04:53:25 -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=r73YVNUogeQQh2OCQkJ87PCfKvjUOXiqppG1mlJY+tA=; b=rIngUfztVdyitlh61n7tkVXy7oGCd/lIlTcyqCLAprSODqatd9OlhlMD10/80OMGOr 5FGwt57NLut8hiLLxJSnvjIzWvr/ahUoPCKcJKo9V5z6+ij4Si+QQUxWb/uMMAGiKmDK 4+kbJowfmwFHtFWsFlwqvKqAQGDuQumECrddkmDHB2KPLj9qpGKhcK8UWUT0ktEp3hPI 37rfiiaLHN/i8rccu+KuNxKnbKmOkKxgz7fXiBPI/OzNV9sTe9w4gOm4d8G0by5ICcRg Zr/lZKSbuxn299MMmS6wGe9aZP5Q/9IM61M1eepquhdZAEoTFi86uyCa4lu6s+7+hLtS SvYA== X-Gm-Message-State: APjAAAWT5k5/oGUzwZkB/R842AEjq375kYeppd2UoHnd2gTrVI67xNOQ 6Hi2g+7l/YxRz28x9lLgD/X7jlDwXo3ZkpGsqz6bZbtWqQq0Zk9G94/Qs/hdeTXQl9E8KtDGfDW iQGw0xNCFB85jLw3aOZGKBZ+RtC8c7upWqc1POFCMKKYBCh6+bvEiy4bcXTCmwh6Lug== X-Received: by 2002:a63:6e86:: with SMTP id j128mr23346082pgc.161.1558958005675; Mon, 27 May 2019 04:53:25 -0700 (PDT) X-Received: by 2002:a63:6e86:: with SMTP id j128mr23346046pgc.161.1558958004871; Mon, 27 May 2019 04:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558958004; cv=none; d=google.com; s=arc-20160816; b=LONM1e8r5KS+33lmzfMRhDwtzhgysaUt7x5fS1wiaLn6TUFDB5yQ/z3qvmhGkHEWIG U9TtQ5fwQCwXb9ykQXpTeB8AFbhnfrKtBYemawdSsyP4fpb+fngPaVR9YgW6mYo4y+Oz olQ+EoD0lfL1darb90L6NSz8E8moCESQ/RJu4SpEVdtYGP3RFGu2kHoMMrlaU46pTsat XHSiWQDOPIvUcN20QPwxJZGGSyNumQQOQHZK2iRnT5HQx6ehPX8Qy5IXjWXF9fvsj0Xy HG3K4OdiiCRVVVfPNnj+KUHSQjufeAESImX7DVNtqiTJf5Byj1amCB4VMUNk7LyIupFN iWQg== 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=r73YVNUogeQQh2OCQkJ87PCfKvjUOXiqppG1mlJY+tA=; b=BjQPjZcKOz6Lku2nvBjQCwDIeriVEwesm7+BxZfGkhoJVrbWwF96tNb8hsRlutHXUY TdGMXnH3mqpuTBUkc/0SuTGVqdkob8JXv/TQeyWxwZpc9KH/mnez2q9LtNJ2b1kCcErx 9M4JkodgNZ1Qro2A94f0u1aic8vwylDUbpdjn2l7+ckOcoqiwfjvZjY7E2XX8VrM1d6S sQmJuF3JVdjjnccUffHg1ZA7nXtF1hNRJ4Pj80ixPaVW4lhAmzQAmSOb81DBxgsWn2mT zxEp8x9yEdc9tg3AhVr+O3Ad0e9VQrpF6AtDC0dN94jhF6NAOutRipYQ+nZzNihQrXdg KYMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fJmSQTvd; 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 c12sor13321005plo.34.2019.05.27.04.53.24 for (Google Transport Security); Mon, 27 May 2019 04:53:24 -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=fJmSQTvd; 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=r73YVNUogeQQh2OCQkJ87PCfKvjUOXiqppG1mlJY+tA=; b=fJmSQTvdW57gnQgvaTIRtL77R4MYePh8dHYlQIhgbJq0oCtiWcMLWEsKJquqlLdum6 04ABXuyugiTd2nahfV/0nubkfTzEzY2cEc8dU90qoJKEAhwXEp3wd/49DaqK4Q0b8aQx cZyMC6VoT6L6xeBrOOATUcD1TM9UxytMuGQwLiQVAeqBCcOagTQpnANGedW4LLsvPbr2 KarWScXsQWDN8zZmczmNxOD3oU50Dcq4bk9RcAgmPBeJBRfWiIyl69igDZWQCdulASWb yTT15wAEAI4YER2n2jZy2Wlc3RqEYww7Kc7Aed+hBuOwKuBCJwVz3E1En9BSXcYY6uoR K5BA== X-Google-Smtp-Source: APXvYqzY+Buvm/j/t01cgDGpqZ3/3YHzji+C6RGkEgWdkRqdT+9SHLr222zOgVqgKjliD6UEkUoKDQ== X-Received: by 2002:a17:902:b713:: with SMTP id d19mr66909393pls.123.1558958004675; Mon, 27 May 2019 04:53:24 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id e24sm9797738pgl.94.2019.05.27.04.53.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 04:53:24 -0700 (PDT) From: Yafang Shao To: mhocko@suse.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v2 2/3] mm/vmscan: change return type of shrink_node() to void Date: Mon, 27 May 2019 19:52:53 +0800 Message-Id: <1558957974-23341-3-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558957974-23341-1-git-send-email-laoar.shao@gmail.com> References: <1558957974-23341-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 d9c3e87..e0c5669 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2657,7 +2657,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; @@ -2827,8 +2827,6 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) */ if (reclaimable) pgdat->kswapd_failures = 0; - - return reclaimable; } /* From patchwork Mon May 27 11:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 10962691 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 E67B01395 for ; Mon, 27 May 2019 11:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D534B28B18 for ; Mon, 27 May 2019 11:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97BC28B20; Mon, 27 May 2019 11:53:32 +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 803BC28B2A for ; Mon, 27 May 2019 11:53:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 123226B0279; Mon, 27 May 2019 07:53:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0D3DD6B027A; Mon, 27 May 2019 07:53:30 -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 EB8AD6B027B; Mon, 27 May 2019 07:53:29 -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 B22106B0279 for ; Mon, 27 May 2019 07:53:29 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id 205so6672601pfx.2 for ; Mon, 27 May 2019 04:53:29 -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=6hNHcE4oGqFxwrfpSxXRKzyk8c9yiV7fnMbtPM3g9Wc=; b=K+RlRtUysDWfuuseXoNUk/SdA2E8RJSXLR7dnUz877mmUcuxUKqESZ6rpB3C7e0ANF N2MAJdLeMarHbMVFVhA6G5lOleJbDDPTRtfnCqhthIBnHIFruSdfSPGr8dJO6pq95KyG LKbIoiqJmqdBLTySuB6Cl+ZlTW/bxHTm9NlCyMqPLTFYjW8b1kEp5KOW6uzjmghXSjsp oLnIkT3SEmvD1nEoZ2UIGjsRqSfWoumaJ+DwojLLcbGerDgThUQV8gULBhd54qInN0UP YeftniHsFch0eVFDxXQ5G98GqVK6xNvUqrAlJuShaJW/lSzzsyHtLQ/L9rIDYIL7Rhj5 8ITA== X-Gm-Message-State: APjAAAWv9l0lGJbRLi3AGl7JCI7aTVxkwzrirNKl6bwsOu3XuCHJmI5u kLDUqAc9zkxMNTwEC20BsHkdGQAYIG+HBxOSsnQvYnWSXjEZExz4KNPwvdNZwkKOerrOfXpukqC avjg7JWmk+wsXIaFlogPZQZZJa7wPdLo12Huf8ULYUbfd8TyR9zY5cvzLDzsJNNJe1Q== X-Received: by 2002:a17:90b:d97:: with SMTP id bg23mr31213671pjb.87.1558958009377; Mon, 27 May 2019 04:53:29 -0700 (PDT) X-Received: by 2002:a17:90b:d97:: with SMTP id bg23mr31213609pjb.87.1558958008234; Mon, 27 May 2019 04:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558958008; cv=none; d=google.com; s=arc-20160816; b=Ww2URthC7POzTMCNHf+Yv2yNq8XqXC3sx7wzwvaXjuKN27FnjJ74mws/9biPEyOe2O 3uKwiwAkyFgt/6eDnwYzZ72wg1J/nK625LJRSHshauNjAyTBUy4bA++8cBpS2mjSlUMl gZICHc8on2RoEPyLONVQugVw6w7nb0A+U62LFRgEhSkdxjLNnW7iNbS8SKhfH5Z0CcdC A0xBCdFgK2/T7qWoTvxPEqExdpQIIzXYG0iJQjCXgt4conbCuhHN2Morho7do/K6TfZZ 9i7mVVyoaKPu+Z1dMra1YyR1IOxpDa+M3kAzlKXe9ZrJKI4RyAOzu7krtTcHf0xqwy6i nByw== 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=6hNHcE4oGqFxwrfpSxXRKzyk8c9yiV7fnMbtPM3g9Wc=; b=YM2xC36CUfPWOZObVYctvIhA++6ZIFpt0dyYAaBSj0UpJWdJkMgwa0OM7OtO6JFa8P 1bO6wEW3UJ5JkxyDqBBX+M5PfxxpwP8mHM9cl5ydEOUnAYPfd8TU6f7vbr37mvxHxFok IqnyRuyzOYkSpU+KMurYoIsRHzDrKi1UwbHnvzT2XkExixKboR2m2MiCEW0wYaQrdeby BqgU6ZeS16a8Ox3RsPp8toffbESrdy4ClfW5aTeWQoudyJpCDBHVlYxgcJh5bFFJQKx5 yRkzbUOPiWZXsVBSk0p4Sf6CzrO+peVK6mYSkKirT6yciyB7QLtedwj8PwLF2gTpeJG2 wsIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DoCDRXYe; 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 m4sor12371147pjs.16.2019.05.27.04.53.28 for (Google Transport Security); Mon, 27 May 2019 04:53:28 -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=DoCDRXYe; 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=6hNHcE4oGqFxwrfpSxXRKzyk8c9yiV7fnMbtPM3g9Wc=; b=DoCDRXYe1dxPitPJWeBaPbykZRlApwkFZ1D8nxrIa660U0HSFp8r7lFHNci3aS6Rzh +RsmyRGs4tLIRriV/yMTxCmidgXbp5VKcKux4ThLUFWh3NgcwV+I/JFk1utUKJCVnmei HvWh+QFpcL3ld8ukLgFX38RcNhgXQ0xADyMTO9Z4DpS6WRPcIuYpkWSbpJoQ1vHPZ6yW KQZk7hSX70iak6ZgdFaMBglo3MpozNi9YdJ8MqEcttu3aCaH+CNA5BNRtdNKRAkeM2Ue 17jjF1qYJiu8RmuENxZ0UpV1Jx23Ste2mvyk4mtZp++Bo3k9sTbf5avOgEeKkMEDbn88 h5Vg== X-Google-Smtp-Source: APXvYqwEhV0Swghh+z3ThQ7hRC6suR0VWsLJFlE6Fb+IZE0SYYh92Ew2cnIvc3ADmrf18T4a9PS05Q== X-Received: by 2002:a17:90a:9a89:: with SMTP id e9mr29786210pjp.110.1558958007989; Mon, 27 May 2019 04:53:27 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id e24sm9797738pgl.94.2019.05.27.04.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 04:53:27 -0700 (PDT) From: Yafang Shao To: mhocko@suse.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, shaoyafang@didiglobal.com, Yafang Shao Subject: [PATCH v2 3/3] mm/vmscan: shrink slab in node reclaim Date: Mon, 27 May 2019 19:52:54 +0800 Message-Id: <1558957974-23341-4-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558957974-23341-1-git-send-email-laoar.shao@gmail.com> References: <1558957974-23341-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. reclaim_state.reclaimed_slab is to 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. Signed-off-by: Yafang Shao --- mm/vmscan.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index e0c5669..c624f59 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4157,6 +4157,8 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in p->reclaim_state = &reclaim_state; if (node_pagecache_reclaimable(pgdat) > pgdat->min_unmapped_pages) { + sc.may_shrinkslab = (pgdat->min_slab_pages < + node_page_state(pgdat, NR_SLAB_RECLAIMABLE)); /* * Free memory by calling shrink node with increasing * priorities until we have enough memory freed. @@ -4164,6 +4166,28 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in do { shrink_node(pgdat, &sc); } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0); + } else { + /* + * If the reclaimable pagecache is not greater than + * min_unmapped_pages, only reclaim the slab. + */ + struct mem_cgroup *memcg; + struct mem_cgroup_reclaim_cookie reclaim = { + .pgdat = pgdat, + .priority = sc.priority, + }; + + do { + memcg = mem_cgroup_iter(NULL, NULL, &reclaim); + do { + shrink_slab(sc.gfp_mask, pgdat->node_id, + memcg, sc.priority); + } while ((memcg = mem_cgroup_iter(NULL, memcg, + &reclaim))); + + sc.nr_reclaimed += reclaim_state.reclaimed_slab; + reclaim_state.reclaimed_slab = 0; + } while (sc.nr_reclaimed < nr_pages && --sc.priority >= 0); } p->reclaim_state = NULL;