Message ID | 20230330191801.1967435-8-yosryahmed@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp92591vqo; Thu, 30 Mar 2023 12:43:49 -0700 (PDT) X-Google-Smtp-Source: AKy350YKXmo292GDKb9E333mMKaF2nw7s0rRfkz1JkjXa12fauwWFYuvbA9E/kHGo2tqMrJRY/RH X-Received: by 2002:a17:90b:1d01:b0:234:656d:235a with SMTP id on1-20020a17090b1d0100b00234656d235amr25710572pjb.43.1680205428745; Thu, 30 Mar 2023 12:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680205428; cv=none; d=google.com; s=arc-20160816; b=VD0AlTtCVR/gRnRwU1GvXYzOhy+nZcAMLAmVLkuumhJt+uyjlOOiZzIJQMZM11ca7q hpKmG50OKdAHaWVcfWToZz2ubkaug/zhswDkxaNpQKR1hC30oXZCq/ZtIqGFcQYM90LG mz1kY92kZukPxfKyGi5uW6WHccFWHd57pI4vIbp0nsswkP72ZTGmyC81IHhz7O1jiul0 4yyBN6bVOeAKa4jAXK6UCBY4/zbRdIFGHiOxO8n4Qw88sZCdXI4bhKun7q1DUfn2hfeW 1eCuyQTfPgilj/5cxLMfaGNgAGMVxOK07za8RPLoyEE3hKp3zrWi8xLG/2FPU78FG3TH cOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=xcUaqJ6BFfuwa7nRJSvBlAwhhxeRf5mk+29EPOCHz/Q=; b=UELL4/0YvcKBaoGXfvBxWoozuw5jECc8jX87822sSZG/MGs/kk6bKOWTGEDgm+SDrk RgfknjedTkr346JfAXGAxG/fqZGfy9Yi1Zt/6RS0WvAbSkDJvx5SQE/6pDV7V9PoSIsh gBhbabtg2r7ekR5nTPR/G7SzWxBL8S5XMnrfc/5mMdFRpNV2kwbiNtST0dUZ632b6PAA lHKnQ2/u7uf+MhjV0QMH2kUuPzf/WoMIzi2xRwMiJsc6VMWhpLi/8n8BgpB++umTtKvY //r1Au5/y7lUXL09+R3LT3398kloMu4u8FHSeEOf7D0rgBFIBEe3AaBxqamAG+Klv/YC /VfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ltNePRXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv70-20020a632e49000000b00513234112b7si330251pgb.899.2023.03.30.12.43.35; Thu, 30 Mar 2023 12:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ltNePRXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjC3TTH (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 15:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231634AbjC3TS1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 15:18:27 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E21071043D for <linux-kernel@vger.kernel.org>; Thu, 30 Mar 2023 12:18:17 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id m12-20020a62f20c000000b0062612a76a08so9219050pfh.2 for <linux-kernel@vger.kernel.org>; Thu, 30 Mar 2023 12:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680203896; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xcUaqJ6BFfuwa7nRJSvBlAwhhxeRf5mk+29EPOCHz/Q=; b=ltNePRXuZIePvYweAMHUj9ZiAeC5qavTrptvs7HWUZy4ZQjHtls0D9eRHEg0pqkaqA 2rj8RSL+AK/a3iTAV1slsfA/XO8i87DoFdpL6M03j+wstTxD0gNLM1Eo1e2c6UpyLkfA 02M3+F6NXEWgNHJDDpxLzGC2sGDBHCNs+LO2yZgTc79ihpz2oe9Gkrj2oQSZRb8nP/pk DTjpgFJ4LNEzmr5tCkDpR0cOQrENPev1JFpwtylRIUOchlXAi5bgsrxJgKXBgxobydtr bGBrN9gUtdaDKVSRv2j9cJxRBN0C3BLXf8CobNS0sZxfbCzcE+BakwfvTig0jcnVMYxC dA2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680203896; 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=xcUaqJ6BFfuwa7nRJSvBlAwhhxeRf5mk+29EPOCHz/Q=; b=XOpzbzcPi8KzoK4Jn7QASMRoVqxrSfp+OO3Ntwoh7C5jjhYQ29GMHFrXwo299xIRDe i8OLYMHVosJNvuGk/OvUWm3Z6qcE0M4PpEuEH7bVXOjRVUQVSp6H/9O+3NJ2b5PiWRwR 6FWoWGmvY16a7t9+WSjW0v/WIx1nAGUDyLaVVsQ/j5p7PStTfcInBch2rXUtt+g79mv/ gxIlgbFMJfrZmsrP+5sWd1oTvKzgieeadBI+xKhWTHJdAo5sY0F2WStX4/PLjTMaYBsf 92FaMFvGRUJuKmE9hnSJ3Pgxx2M0HVymUpEXRlr432Z4SdnrjMHAb7PsbSJMK/zeSWM9 f+cQ== X-Gm-Message-State: AAQBX9fteGM2mU03DP8zCKUrt3O5acZyqs9Uc4/wpmnz/QU347szdkqR OOVm1A/5ihcxIuep1Veosa2p8kNns3HXFEU5 X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a63:40c1:0:b0:4fd:5105:eb93 with SMTP id n184-20020a6340c1000000b004fd5105eb93mr6667473pga.3.1680203896567; Thu, 30 Mar 2023 12:18:16 -0700 (PDT) Date: Thu, 30 Mar 2023 19:18:00 +0000 In-Reply-To: <20230330191801.1967435-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230330191801.1967435-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230330191801.1967435-8-yosryahmed@google.com> Subject: [PATCH v3 7/8] vmscan: memcg: sleep when flushing stats during reclaim From: Yosry Ahmed <yosryahmed@google.com> To: Tejun Heo <tj@kernel.org>, Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>, Zefan Li <lizefan.x@bytedance.com>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Muchun Song <muchun.song@linux.dev>, Andrew Morton <akpm@linux-foundation.org>, " =?utf-8?q?Michal_Koutn=C3=BD?= " <mkoutny@suse.com> Cc: Vasily Averin <vasily.averin@linux.dev>, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Yosry Ahmed <yosryahmed@google.com>, Michal Hocko <mhocko@suse.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761823087236964755?= X-GMAIL-MSGID: =?utf-8?q?1761823087236964755?= |
Series |
memcg: avoid flushing stats atomically where possible
|
|
Commit Message
Yosry Ahmed
March 30, 2023, 7:18 p.m. UTC
Memory reclaim is a sleepable context. Flushing is an expensive operaiton that scales with the number of cpus and the number of cgroups in the system, so avoid doing it atomically unnecessarily. This can slow down reclaim code if flushing stats is taking too long, but there is already multiple cond_resched()'s in reclaim code. Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Acked-by: Shakeel Butt <shakeelb@google.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c index a9511ccb936f..9c1c5e8b24b8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2845,7 +2845,7 @@ static void prepare_scan_count(pg_data_t *pgdat, struct scan_control *sc) * Flush the memory cgroup stats, so that we read accurate per-memcg * lruvec stats for heuristics. */ - mem_cgroup_flush_stats_atomic(); + mem_cgroup_flush_stats(); /* * Determine the scan balance between anon and file LRUs.