From patchwork Thu Mar 23 04:00:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13184908 Return-Path: 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 8D786C6FD1D for ; Thu, 23 Mar 2023 04:00:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5E196B0083; Thu, 23 Mar 2023 00:00:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE6CB6B0088; Thu, 23 Mar 2023 00:00:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A39EB6B0087; Thu, 23 Mar 2023 00:00:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 919AF6B0083 for ; Thu, 23 Mar 2023 00:00:53 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5B7E8120169 for ; Thu, 23 Mar 2023 04:00:53 +0000 (UTC) X-FDA: 80598811986.26.A5C2F9E Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf13.hostedemail.com (Postfix) with ESMTP id 8EF9F20018 for ; Thu, 23 Mar 2023 04:00:51 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VdCCijFi; spf=pass (imf13.hostedemail.com: domain of 38s4bZAoKCCcbRVUbDKPHGJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--yosryahmed.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=38s4bZAoKCCcbRVUbDKPHGJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679544051; 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=9m7S+Ebo8MkLWAncbvKsOW8wVqp1O+0Jr3lM7bEbkLI=; b=7sMZ5fDy3RPYQ+guBjaZXTHGSS55FwIFGFVSoh1TjvRGPbj1em299GDJc6cYfLYObUcCfl jplYBTxz9POc4QpfpKhDzTlZVC4Io62Yu+UeGgeD3TBeandWdtRGlc3/Www0gLXAsjFIcP 0ey+eOPbvYbks6R2ANBCz9ry9q8xSpg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VdCCijFi; spf=pass (imf13.hostedemail.com: domain of 38s4bZAoKCCcbRVUbDKPHGJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--yosryahmed.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=38s4bZAoKCCcbRVUbDKPHGJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679544051; a=rsa-sha256; cv=none; b=BJEJiV3DBGFIwFVmIf6B1P9s4ANJIjDg9loE3u4VdCIdwHGcLhVLHARNN7Qls9L2Lprndk qMVbayKRes5wHViAOqyociweHTR6B8pGJjE+dgb6VKdSOriPZQez2t/ogNLZmMUh90+5+x QDlWkEvOeoOYXca4boPyVSPNfyOMYTE= Received: by mail-pg1-f202.google.com with SMTP id e36-20020a631e24000000b0050f76fb84b6so3544146pge.8 for ; Wed, 22 Mar 2023 21:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679544050; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9m7S+Ebo8MkLWAncbvKsOW8wVqp1O+0Jr3lM7bEbkLI=; b=VdCCijFiKDJ4yDz8tFMap2tBXNfAakMH2cmowf1HUrZHuzx98c171wgP+Q37bsMmOY dvm3L1704oXKLAgAkOK0GjUnYQoP54+fQujrx3ACvUW9YBMoC0EV4BPolgDqFHWKSqHY vC+M0AbP8Thw306r5f0tU0s0RnClNRrpM7iLZQZCh4urjjm1nPlLVN2cvKbhB0gks3OE JIza4tgsYELq7gTHgeHRM8vhlVtpzgxg6m7gbPXptQ7q4d0Q9K++kyZO3UiZG82ponKY DM+ht1D3A+Eg8Co2dt+ym/gky/eIx2ki3TeVSJ2PxhVMHdlX5/2KaImaACWOeUxKy2jU FXPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679544050; 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=9m7S+Ebo8MkLWAncbvKsOW8wVqp1O+0Jr3lM7bEbkLI=; b=hI8omRw54QQcJAJmy4sQKbNzhdmYpnwH0YKGWmLdy4MrqrUNtQ/+Ddh2xoRC9RqjHn pt+993N3Mjhdbn919WUlBGN5D7zWwsfa3Nb1AG8MZC3z4700Y8PkPSWM8Ga3s16p1iDQ XqVlmxMWozF0YnOe19vKJgjUUjtSJ9XHM80Qt3PKAQQDFVIb/5cqgSCgURc+5i8hIunY 7VFyPhDhDb3gelDvDuESwGQ/p7BlcaRAvcTEGGi+igk6otOCCnVHZ484PDDIOxXYyMf7 Et2C4cBZqRqmslwKT85xj/GwbqJ/Lkn1iTq1pIJStMKPO1SEiS6bEf0e/dTAHn3jv234 yMfA== X-Gm-Message-State: AO0yUKW2jin9BbLvxOtZpQFyKOBO2RcHqmDp94+Ckaf6KE6ScnCuB1p1 I/zJP2jC2VWboCvivYOKm7WUY+AzHGq6cvuP X-Google-Smtp-Source: AK7set+m4AnWZnXPXOtgLtJe2rjiQdXqc3xUA0g5EOBUkvh8xUumZjwEW1aaQclKH89BoDnkrewjWDyAajrYgNTk X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:80e6:b0:623:8a88:1bba with SMTP id ei38-20020a056a0080e600b006238a881bbamr2937696pfb.2.1679544050539; Wed, 22 Mar 2023 21:00:50 -0700 (PDT) Date: Thu, 23 Mar 2023 04:00:35 +0000 In-Reply-To: <20230323040037.2389095-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230323040037.2389095-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog Message-ID: <20230323040037.2389095-6-yosryahmed@google.com> Subject: [RFC PATCH 5/7] vmscan: memcg: sleep when flushing stats during reclaim From: Yosry Ahmed To: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton Cc: Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Yosry Ahmed X-Stat-Signature: 9tu3srq5dcfqm4jek1a3k15mend4urc6 X-Rspam-User: X-Rspamd-Queue-Id: 8EF9F20018 X-Rspamd-Server: rspam06 X-HE-Tag: 1679544051-41225 X-HE-Meta: U2FsdGVkX1/zcdI2lpAb0iEiujsDuVrYueVN0G87fVNqOCD6FqLQ91WkeRQjxVFutxWt4Te7V78F/hVQZIWPQtE642hFGSMVfmHy43Gn+WjKz8/82sCVkDh8FGtGFkRsFZHO91lxoGprpe2XBFxe51ZR6nWdbfOPEo8J+T5pJG8PNBDHpmg062URFT0Nfe3HFcCA5jFtksTlCGKMueXOS2AtBh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rTZ8xJj93Mij+iQrVRh2olvMAddyQNZ+0PYEspc19ub4fdqGIK+Yy0VKRHYReurkKtPoqrhK8JX7pDFfVOSsvgcqmDsXq0UIjTXMBQXtWCbz7NBfqsgbUfm29kvCJhWBSlLqhd4SUOy83e82RqMPbpKxOkTpIVMnHa0JlH7+gEvXG8kErhoA8nrSC4S2/EvBNsrl20fxDvrKhqZDN3W0+7iokmymV73tbgJquVtuNd+9jrCOwFE8UO0mi5o89eVUIQfzmCAcGB5pqGxTQ+MrD9FRpmP4hiTwl8oq7IAO6pIDR8+FjDSqPfH7JkYCO0Ux4+VJt2ofeTds3dyoFBCg/bqHCvauUwATOEIRo0Ow== 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: Memory reclaim should be a sleepable context. Allow sleeping when flushing memcg stats to avoid unnecessarily performing a lot of work without sleeping. 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 --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 59d1830d08ac..bae35cfb33c8 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(false); + mem_cgroup_flush_stats(true); /* * Determine the scan balance between anon and file LRUs.