Message ID | 20230202233229.3895713-3-yosryahmed@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37CB6C64EC4 for <linux-mm@archiver.kernel.org>; Thu, 2 Feb 2023 23:32:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4BDC6B007D; Thu, 2 Feb 2023 18:32:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD2436B007E; Thu, 2 Feb 2023 18:32:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94D9B6B0080; Thu, 2 Feb 2023 18:32:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7F58C6B007D for <linux-mm@kvack.org>; Thu, 2 Feb 2023 18:32:40 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3C050AB82A for <linux-mm@kvack.org>; Thu, 2 Feb 2023 23:32:40 +0000 (UTC) X-FDA: 80423953680.27.2250C56 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf18.hostedemail.com (Postfix) with ESMTP id 6109A1C0010 for <linux-mm@kvack.org>; Thu, 2 Feb 2023 23:32:38 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hOhCADwP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 3FUjcYwoKCDwwmqpwYfkcbemmejc.amkjglsv-kkitYai.mpe@flex--yosryahmed.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3FUjcYwoKCDwwmqpwYfkcbemmejc.amkjglsv-kkitYai.mpe@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675380758; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0NNiCqwzESyAJCUAtzOveFlWcEoCPQvaoYU5oWya4UE=; b=MjwBDmRiI4g4d6x8EVUqwMlwdUZhAz9CwbzgBXI8uJRG8nlXh3H5wYAKRkSjjlLl+dEaCG o5Gd1cvoPDPo3EDn2IPYooVqzGZuW3Xtju8QE2ql01kWaf5qPku5ivTOx9Ygg8KIzc9Kng /qu3YNKyEk2rjrNGZl4Ned9xCmJlXwg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hOhCADwP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 3FUjcYwoKCDwwmqpwYfkcbemmejc.amkjglsv-kkitYai.mpe@flex--yosryahmed.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3FUjcYwoKCDwwmqpwYfkcbemmejc.amkjglsv-kkitYai.mpe@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675380758; a=rsa-sha256; cv=none; b=AOjrOmI6d/4h1OEqZIGgEJ8u5gN2URXhTOI7i5MnOcns+qpX0Rz5nTEFAQSoWMy2dpC+oR 2ErorT2hhQWjKpD0xQV8Nuh7nm8/CXXUQwVrzijnfG63HaYKSRZHo+d0zXQIZ/P2fdcaBY MM2crFJZGROPPW3J54Ceyg3PuVSFDmY= Received: by mail-pg1-f201.google.com with SMTP id x3-20020a654143000000b004f2f2dafb21so596635pgp.0 for <linux-mm@kvack.org>; Thu, 02 Feb 2023 15:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0NNiCqwzESyAJCUAtzOveFlWcEoCPQvaoYU5oWya4UE=; b=hOhCADwPkxUGmi7V1P/nnFPjlarle5tUS/LLXkpE2OMQZSESuPz1Yg7ch5+w2lQPvZ Tg/E8g4ve+TuLwEeRfChTbEYbLJeSDJDBhmLL+z83Q3UbkFRR/7iALI3n//9YzuETtUk /td2TUtQtadczPSW8P9uXTi/L7bXWxzWMSBHRmqrt9SBSEfcBH/jtfBlcjWv7c1f+PLe QQJMnYWOv7ywl4B7eaZ7s3dALT60pveMbI3kcs7UOtDp14gKlyebUk9ejlg7acW+153Z oPfBCDEgRhQOIX+ZejkUx9YYjTBJC43e4lfmtvzzmccRB1Rl0AHErHGP8WlCALz8YStS jSAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0NNiCqwzESyAJCUAtzOveFlWcEoCPQvaoYU5oWya4UE=; b=VnvHVzGj3T7+Neiohmu2bWQzZM0W64uozSaRoZSSfqeMAljHR6C5Lv3JCYdHaLWp+A 8a6G+52PN/KpEK460vlhQf4tqYiqNtW4Kc/Qd6w1TApkoo3RgkUPr2Kz74i7xOtPfroZ MFRUtfWaIHXnE1lz9cCRfGYiPetove/csU3K/cGdZfZ3wUvkr7CFYd3nwFbKG1odhhAJ ytJsMYDewBHSJuB9ljOhzOQ9NpvcsnHmW+dQsL977wO324B1Ne/iJH3i+c/sgWoyoRh6 O0GU4Xbkx54mhRnIW3wSkziCQgOtAOCPFcwT9kjVLQ1FNrB2LVgSYbxD+SA4LFx+kZ1W vNRg== X-Gm-Message-State: AO0yUKX2WbSaEgcUhpWFc4yp1/9MrozvsC1vMrIz8WpG+/e000xwfMym q1HdCuGevrngWuXzLsb+XoRw/jaWsXjJ8cCi X-Google-Smtp-Source: AK7set/gX+d7qL2VYRm0mNT1mURMK3jqpTnNExhfErr1wouO0vmd1XoXrrDp0BwbdxbCN+7oo8RXZwzOeOx6nPe4 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:903:1c8:b0:193:9ec:fc13 with SMTP id e8-20020a17090301c800b0019309ecfc13mr1942596plh.33.1675380757137; Thu, 02 Feb 2023 15:32:37 -0800 (PST) Date: Thu, 2 Feb 2023 23:32:29 +0000 In-Reply-To: <20230202233229.3895713-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230202233229.3895713-1-yosryahmed@google.com> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog Message-ID: <20230202233229.3895713-3-yosryahmed@google.com> Subject: [RFC PATCH v1 2/2] mm: vmscan: ignore non-LRU-based reclaim in memcg reclaim From: Yosry Ahmed <yosryahmed@google.com> To: Alexander Viro <viro@zeniv.linux.org.uk>, "Darrick J. Wong" <djwong@kernel.org>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Vlastimil Babka <vbabka@suse.cz>, Roman Gushchin <roman.gushchin@linux.dev>, Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Miaohe Lin <linmiaohe@huawei.com>, David Hildenbrand <david@redhat.com>, Johannes Weiner <hannes@cmpxchg.org>, Peter Xu <peterx@redhat.com>, NeilBrown <neilb@suse.de>, Shakeel Butt <shakeelb@google.com>, Michal Hocko <mhocko@kernel.org> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Yosry Ahmed <yosryahmed@google.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 6109A1C0010 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d9EfeMxjkykZd I/WI4O4k GlJi1vrNJjpGPcBWbkdcnPsnIRkR9TdWOZhdGlzUhAiwxZqVxNwpNFCjASYN8GPcRKRzx0Sf2NRPUPXSLACmTs15tDi+YEvHrI4JIuVKZi95cAxl5sAopW3V7blByDRwonJfOqzmEzg9Zpv2Zbf5cALmcMesj8alEBAPLfvzZQInPmDHVvXLnUsDmHnJ8RDypvoO1lzZe9R1309EAeZQbpJfTSBQKl4nGRAhYjXq+m4lUraiIKE1rDCbPNCGk0XyIW1muzDYS8xKOgJGnIiIvdQiJb9PZHFmE92P5DnwpJHicOn4Geq2N8kpO2AXTZyyEPBuLbw9twHZV11KnSTMMnQwdTrhzipuLwrjxEKeUMgvRR4150NJ6V1+03B6z9/WaeAb9+u6i18f7VoAQfgS3yGjtvuoE9GygB7JIYtsrb2Tx/rX7wzgkd0iMVd37apdd6ub68HUeJwHiPT89wdc8fAq9DjFtsN6gy5GlnNi5BpitJmxOkJ39YGsiVFircqMDJwbd5lq/m/+LK1Hqi58FZRFGlaa+QPeHu7+eiLAkd4ngVCEZzoMgy6JSwnK2ZI9DR0gFhrv8A1D4lv95eDdegIdXxTNjSwBXygDdR+fITkZtxm2wX274XGOpf/YpW7KgXmADjLi7qPpXfZnWFBCV83GsIXry5KvojucDcS1EBKZ8wqoasPtAbgwF6xXcAafCwWOlL0WWeLTxYfIJ1CSnpjXjzIR8/fU6natF 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: <linux-mm.kvack.org> |
Series |
Ignore non-LRU-based reclaim in memcg reclaim
|
expand
|
diff --git a/mm/vmscan.c b/mm/vmscan.c index 63a27d2f6f31..207998b16e5f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6181,7 +6181,7 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) shrink_node_memcgs(pgdat, sc); - if (reclaim_state) { + if (reclaim_state && !cgroup_reclaim(sc)) { sc->nr_reclaimed += reclaim_state->reclaimed; reclaim_state->reclaimed = 0; }
We keep track of different types of reclaimed pages through reclaim_state->reclaimed, and we add them to the reported number of reclaimed pages. For non-memcg reclaim, this makes sense. For memcg reclaim, we have no clue if those pages are charged to the memcg under reclaim. Slab pages are shared by different memcgs, so a freed slab page may have only been partially charged to the memcg under reclaim. The same goes for clean file pages from pruned inodes or xfs buffer pages, there is no way to link them to the memcg under reclaim. Stop reporting those freed pages as reclaimed pages during memcg reclaim. This should make the return value of writing to memory.reclaim, and may help reduce unnecessary reclaim retries during memcg charging. Generally, this should make the return value of try_to_free_mem_cgroup_pages() more accurate. In some limited cases (e.g. freed a slab page that was mostly charged to the memcg under reclaim), the return value of try_to_free_mem_cgroup_pages() can be underestimated, but this should be fine as it is mostly called in a retry loop. Signed-off-by: Yosry Ahmed <yosryahmed@google.com> --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)