From patchwork Wed Jan 30 04:17:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 10787681 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 BAFBE13B5 for ; Wed, 30 Jan 2019 04:17:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAAF02C56B for ; Wed, 30 Jan 2019 04:17:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F00B2DDEC; Wed, 30 Jan 2019 04:17: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=-2.9 required=2.0 tests=BAYES_00,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 B29912C589 for ; Wed, 30 Jan 2019 04:17:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7320D8E0003; Tue, 29 Jan 2019 23:17:19 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 70D9C8E0001; Tue, 29 Jan 2019 23:17:19 -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 583708E0003; Tue, 29 Jan 2019 23:17:19 -0500 (EST) 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 18FE68E0001 for ; Tue, 29 Jan 2019 23:17:19 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id 74so18696551pfk.12 for ; Tue, 29 Jan 2019 20:17:19 -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:mime-version :content-transfer-encoding; bh=8Q997Rl4ZH7D4iZIqIGbV0pd1Ue7utgCKr6lu5VJOr4=; b=qbg7IqsIoUH7mJ4FsH9hGRNDL2f8KlAgs6J5Pb42LvEK8g9NmOKpQ20ivp4VlBnRx8 g0tQT1OHtnvpmNqo6fSrxjaHSHJP5wMVBSPG2xGN6vkrSRTZYEu+n2lH21j9tmmNVUHy bGqEDpODfk9aS7pRl/h9VMCEIFrJvmmb2uFL8DBVHwTu83vApU/rcdLIO1z63/W+AOur VekbdTXH2urrmUsJGdQNRIE0yl3NqshTcN5qNsWT5KYXeyM28kdvDqEnb5LoCCIL8j24 ERKtwGTHeXwn6I2/rfee9dRW6AIQL4cIKYkcwLwMW5sfG3tg/vwwz8Oux9qzDdhLP9kl xBDA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com X-Gm-Message-State: AJcUukeO/Rxy4RKT/bhh1RScXXdnXfHir4P34WhtMD8kb1n3C7zU45Sd yxhlqBWWZgcTKZ9u7tkP1mx1CR3UrdoGIsmBP6CIO2xeLE7mwc5MJUzWuN4qUdTUlSVSL+HFKY7 ciGswjgc83JtjbTQB1EYQePFHNoXGLLzKoKTaMD5P8qqbJB6LEBeKpCeltc2mQY4= X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr27893028pls.322.1548821838746; Tue, 29 Jan 2019 20:17:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5O1DHcDv+9BP5CM1/S3Hp2GiE7LeWmEnp1xImX1fKaNlSxHsT54YppYt/3m5Jp0ui2P+W1 X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr27893007pls.322.1548821838041; Tue, 29 Jan 2019 20:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548821838; cv=none; d=google.com; s=arc-20160816; b=tMKIvf92pA4h+srugTwG1QdKnjuGQINfxP9wmwTRB3+RJtYKybHznOg7zdA/DqQ1HB JLG6ZlM4bDK9oig+7uBL27qaBfqU4Y/rDFx2xTcnw+N8whxlR0GwZF3qFh+Tz4qJ48Gn FFQFlYAneZo3lduIvy9mq9eNSfyk1Z4rU68o4ZBZs9LDH4ZiOi4j8xloh8NWqCJ7LCi8 v8L2srzl4MQlmFJ0vxfBvZU3mWP4rn31WWG9hQJB01KfrfVQwJotYYl/lJydzO1xm/vi GGACwwOXVEtS1odK1QUbGamAHlthvxr2grQsXYF3/VY8O1nufvSuU9twIjeWuJD5uYdp 2idQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=8Q997Rl4ZH7D4iZIqIGbV0pd1Ue7utgCKr6lu5VJOr4=; b=mcn997Lupqr7TCSlT4+w5v7h8MRkwueEwGrqvXn2LA2UgSOun+wzQvzd23Iz66DUDY WlExB4Q/VgqnnA12ij3TM3KvKJb3VrePcexsdogUVRsENlpEP9jDJFusCRvhZJjCCJOu /2H6Bl7JH2/SSkYxmYTsm6WhN53MQElztjMLsMooUKUD8IuA2pq4aAwqLr9T7AZ5vusW N0BaEmraFOrsw67Fg8bULG7CV+yIoYd3nCHUj9gTfPLv0Sc5Gdilk6Y+WJFobc5JpEub lJy0aSqIBoEh6BicDzZWFI63Mnb2y+CG4dvxRtumuh8gb+QPdh+hM+Qvbcs/sRBaEZT9 Pckg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com Received: from ipmail07.adl2.internode.on.net (ipmail07.adl2.internode.on.net. [150.101.137.131]) by mx.google.com with ESMTP id m7si489222pfc.118.2019.01.29.20.17.17 for ; Tue, 29 Jan 2019 20:17:18 -0800 (PST) Received-SPF: neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) client-ip=150.101.137.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail07.adl2.internode.on.net with ESMTP; 30 Jan 2019 14:47:14 +1030 Received: from discord.disaster.area ([192.168.1.111]) by dastard with esmtp (Exim 4.80) (envelope-from ) id 1gohJJ-0000dS-L5; Wed, 30 Jan 2019 15:17:13 +1100 Received: from dave by discord.disaster.area with local (Exim 4.92-RC4) (envelope-from ) id 1gohJJ-0007eF-JI; Wed, 30 Jan 2019 15:17:13 +1100 From: Dave Chinner To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Cc: guro@fb.com, akpm@linux-foundation.org, mhocko@kernel.org, vdavydov.dev@gmail.com Subject: [PATCH 1/2] Revert "mm: don't reclaim inodes with many attached pages" Date: Wed, 30 Jan 2019 15:17:06 +1100 Message-Id: <20190130041707.27750-2-david@fromorbit.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190130041707.27750-1-david@fromorbit.com> References: <20190130041707.27750-1-david@fromorbit.com> MIME-Version: 1.0 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 From: Dave Chinner This reverts commit a76cf1a474d7dbcd9336b5f5afb0162baa142cf0. This change causes serious changes to page cache and inode cache behaviour and balance, resulting in major performance regressions when combining worklaods such as large file copies and kernel compiles. https://bugzilla.kernel.org/show_bug.cgi?id=202441 This change is a hack to work around the problems introduced by changing how agressive shrinkers are on small caches in commit 172b06c32b94 ("mm: slowly shrink slabs with a relatively small number of objects"). It creates more problems than it solves, wasn't adequately reviewed or tested, so it needs to be reverted. cc: Signed-off-by: Dave Chinner Signed-off-by: Rik van Riel Tested-by: Chris Mason Acked-by: Roman Gushchin Acked-by: Johannes Weiner Signed-off-by: Andrew Morton --- fs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 0cd47fe0dbe5..73432e64f874 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -730,11 +730,8 @@ static enum lru_status inode_lru_isolate(struct list_head *item, return LRU_REMOVED; } - /* - * Recently referenced inodes and inodes with many attached pages - * get one more pass. - */ - if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) { + /* recently referenced inodes get one more pass */ + if (inode->i_state & I_REFERENCED) { inode->i_state &= ~I_REFERENCED; spin_unlock(&inode->i_lock); return LRU_ROTATE; From patchwork Wed Jan 30 04:17:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 10787677 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 AB0636C2 for ; Wed, 30 Jan 2019 04:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 928162C589 for ; Wed, 30 Jan 2019 04:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 847302DDF8; Wed, 30 Jan 2019 04:17:20 +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 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 1FE912C589 for ; Wed, 30 Jan 2019 04:17:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 908A78E0002; Tue, 29 Jan 2019 23:17:18 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8B6838E0001; Tue, 29 Jan 2019 23:17:18 -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 7CC4D8E0002; Tue, 29 Jan 2019 23:17:18 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 3CB978E0001 for ; Tue, 29 Jan 2019 23:17:18 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id l9so15881940plt.7 for ; Tue, 29 Jan 2019 20:17:18 -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:mime-version :content-transfer-encoding; bh=W1FE2bpb5OpVzPkW6sAIQNI2BbpKiJHL6X2rHy29RYg=; b=raWotJxUzPBIJZo7QSDTVDdatEJZjvzJgUeP0puqX0gByY2WjZzBKIRpASSKH/N5WN T33qW99+fQ+lmIF73OsDzL5qyhDHriEmD1aERih5pz4mwu0u3q8MfD1SbzCSsbFUZg6P chIzIpxnQ/bOSGN2NFTQSgjpOe/2g6EyfpabebXBQylJvjDa+rlEGRg16caXe9Nowek1 wdTpByuE90m80ujZpB1tm5IjzQMkoXoiqFmRnnD9TFtpt0cq7loUwxstl/izO9/cr+UY xupXzY/ceG3ouvwNDHKNNmQGDf+u1goxYGpmBvD+lK+sVKhgB+JjzjbMRhNMfQiTk7qy R81A== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com X-Gm-Message-State: AJcUukcGqIyEg/9fkDl32WKhqMUFw45W1P4veKONpTZUhkUzhhieV1Ck vJne6FkU9TGSK91FtPEzdjl63XERchDwVPnWQ4iFQmlP1RTQY44lWCYyTaO+iBXcDlSwbUmcPWP IOwZqTomRsoL6p9eTF/YSUsr53YnJdjN61Q+8YNFlXwYrqVYKRUEi7GKMkU8UOtg= X-Received: by 2002:a62:9719:: with SMTP id n25mr29949561pfe.240.1548821837723; Tue, 29 Jan 2019 20:17:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4SYeVPBC4ApvaNiU9ueOHskJ95r3ov4Y8HutwDui2L5ww7KOoboSz/ESBD6k6a21pli1Yx X-Received: by 2002:a62:9719:: with SMTP id n25mr29949530pfe.240.1548821836872; Tue, 29 Jan 2019 20:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548821836; cv=none; d=google.com; s=arc-20160816; b=LFsAixJt90A2etWqrrQysouHi6VM00vlDpEcQ5Qz92D6JTaJRV3H7FCvgAMq7EfBBZ BDGFFHZ9lWZ4hkYLHHeBzGBpg4UYyDrLxbEnr6bDhlQCUMm4lqr+xKq+GTH3KMS3m6N3 emXW2juFmqJMUhCtffqNbxoc+fMDIEz/PE13t6bdoKVEbUNJdjewjfLiGe+rfGJJIce7 A1vEuEvlBdxq0hGgZHBt0Wme/3q22kPiLBkYmJnXzWv5QebuRvKF9jke5dno9iEaw9ut BVQfqzptjOrcQzAL9t66IyXPHRcjoyVEW4Wm+e/3zOy5gUdAmZGw6Dd0mPK+gxJN3szp 6f9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=W1FE2bpb5OpVzPkW6sAIQNI2BbpKiJHL6X2rHy29RYg=; b=bmiBFuNkePyL1tJOGqGLxPPSFae4PUoYGJr2QNh8n79yeZ/+yjAdz2HY2G1tAISKQu GlV3fHdW0XFur5pCpoenKYTasdgpLMGEI70Pyl4PJQnWNpkN1gcn9XHvfs7p7N+f+daL pK/X165ea04hBryOcdzkUCcq+eg0kQeRZKs/pQrob4qQnza/l24jYAXaXGLmny19PoCn yGyf4nuPeGBn1VVMoAmceO6lJyHqHaDWVcKomNX3p5NU88NYvqDcQBKXC3erLO90Mll3 TEBMfhYCuqvBSKwx0xW/+8SmpmdKmPpYHLNpmBILPrWaJq3dLnfDoLPAfViRaIijJSxj NAGA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com Received: from ipmail07.adl2.internode.on.net (ipmail07.adl2.internode.on.net. [150.101.137.131]) by mx.google.com with ESMTP id m7si489222pfc.118.2019.01.29.20.17.15 for ; Tue, 29 Jan 2019 20:17:16 -0800 (PST) Received-SPF: neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) client-ip=150.101.137.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 150.101.137.131 is neither permitted nor denied by best guess record for domain of david@fromorbit.com) smtp.mailfrom=david@fromorbit.com Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail07.adl2.internode.on.net with ESMTP; 30 Jan 2019 14:47:14 +1030 Received: from discord.disaster.area ([192.168.1.111]) by dastard with esmtp (Exim 4.80) (envelope-from ) id 1gohJJ-0000dT-MN; Wed, 30 Jan 2019 15:17:13 +1100 Received: from dave by discord.disaster.area with local (Exim 4.92-RC4) (envelope-from ) id 1gohJJ-0007eI-Kc; Wed, 30 Jan 2019 15:17:13 +1100 From: Dave Chinner To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Cc: guro@fb.com, akpm@linux-foundation.org, mhocko@kernel.org, vdavydov.dev@gmail.com Subject: [PATCH 2/2] Revert "mm: slowly shrink slabs with a relatively small number of objects" Date: Wed, 30 Jan 2019 15:17:07 +1100 Message-Id: <20190130041707.27750-3-david@fromorbit.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190130041707.27750-1-david@fromorbit.com> References: <20190130041707.27750-1-david@fromorbit.com> MIME-Version: 1.0 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 From: Dave Chinner This reverts commit 172b06c32b949759fe6313abec514bc4f15014f4. This change changes the agressiveness of shrinker reclaim, causing small cache and low priority reclaim to greatly increase scanning pressure on small caches. As a result, light memory pressure has a disproportionate affect on small caches, and causes large caches to be reclaimed much faster than previously. As a result, it greatly perturbs the delicate balance of the VFS caches (dentry/inode vs file page cache) such that the inode/dentry caches are reclaimed much, much faster than the page cache and this drives us into several other caching imbalance related problems. As such, this is a bad change and needs to be reverted. [ Needs some massaging to retain the later seekless shrinker modifications. ] cc: Signed-off-by: Dave Chinner --- mm/vmscan.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index a714c4f800e9..e979705bbf32 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -491,16 +491,6 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, delta = freeable / 2; } - /* - * Make sure we apply some minimal pressure on default priority - * even on small cgroups. Stale objects are not only consuming memory - * by themselves, but can also hold a reference to a dying cgroup, - * preventing it from being reclaimed. A dying cgroup with all - * corresponding structures like per-cpu stats and kmem caches - * can be really big, so it may lead to a significant waste of memory. - */ - delta = max_t(unsigned long long, delta, min(freeable, batch_size)); - total_scan += delta; if (total_scan < 0) { pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n",