From patchwork Tue Mar 28 06:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13190561 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 A64A8C761A6 for ; Tue, 28 Mar 2023 06:16:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4685F280005; Tue, 28 Mar 2023 02:16:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43F31280001; Tue, 28 Mar 2023 02:16:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BAAC280005; Tue, 28 Mar 2023 02:16:59 -0400 (EDT) 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 18617280001 for ; Tue, 28 Mar 2023 02:16:59 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E9CF880495 for ; Tue, 28 Mar 2023 06:16:58 +0000 (UTC) X-FDA: 80617298916.08.F30F791 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf06.hostedemail.com (Postfix) with ESMTP id 31CD0180017 for ; Tue, 28 Mar 2023 06:16:56 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BGZjnL6U; spf=pass (imf06.hostedemail.com: domain of 3WIYiZAoKCBcLBFELx49103BB381.zB985AHK-997Ixz7.BE3@flex--yosryahmed.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3WIYiZAoKCBcLBFELx49103BB381.zB985AHK-997Ixz7.BE3@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=1679984217; 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=x7IFy8THM3GBUAgd4d/GEKRMIpmDkqCRA5AxR/3TFCM=; b=XKGzvPT8miH9f2bmU7HW+REbntpyqDV8vm2B2DSd13Ilc0MSOPBTn57mkvcB9Hsx+ih4dA 63JUsXeHsxTbjvNZ19v6pxpwST2DfOAAj92x6ug1kwvZJjZvXKTSl8llDdx0z1O41QYpRG ivt9O5mUxSISUQitM4iSllbiXTMieEE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BGZjnL6U; spf=pass (imf06.hostedemail.com: domain of 3WIYiZAoKCBcLBFELx49103BB381.zB985AHK-997Ixz7.BE3@flex--yosryahmed.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3WIYiZAoKCBcLBFELx49103BB381.zB985AHK-997Ixz7.BE3@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679984217; a=rsa-sha256; cv=none; b=Uw/6mStdSu2EoO7u5KY3ESCZFNbIQ5+39HXnEHoPS6L4GIN2BjJ2nyMx5vO/yp717/NyJM JelRJ4Xnq9hcAJ1H+J4I2ChFB/OGvC2n7R1PzPmELkjqgy0mC+Vtg2+Dk4zvjywQ5F4SQr 8prWJFjzALGqnQCIVb6RGViusBCxR8I= Received: by mail-pj1-f74.google.com with SMTP id nm11-20020a17090b19cb00b0023d0c90d851so2939752pjb.1 for ; Mon, 27 Mar 2023 23:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679984216; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=x7IFy8THM3GBUAgd4d/GEKRMIpmDkqCRA5AxR/3TFCM=; b=BGZjnL6U27C3nu3nfjJxe/VV851RC/VP1GsLD606AgPd6FshXe6WNQk0I659Owa2wU gVJoC9Crt60CfuYM+ql+MgbEx44waD/ankuLiQjCR+6oc5mr8Ex9gHFcY/MTbuN2MESv WG+o2vmHU2skqPZDZWhEEvumwbMUFH8XB/2P7lCWIxY9j69P+XyQb7YmlC5lJf3dl83N R/+G9MzJdyv2aInyc3KBZTsCKswAeBzT3OW0sicqNfQnZRl6LhPxfTDtAjqxejZWrmX4 kekpZffHaXAsR+R6/xnXuXgj0ngR8GdA98eO9lk+Gv9Mx4rtmu3ZFp7UhRacTBWLo1ks cDtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679984216; 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=x7IFy8THM3GBUAgd4d/GEKRMIpmDkqCRA5AxR/3TFCM=; b=DkaOauf7BRSlMGR1dCgKhyWS0LDhXcnFDSLn55qpG4f75EaQC6N9M2oWNNxeXvjq39 5hxoNBXs5uamnMQ9I4/0wpJnjhUrIqyUvc+CNAyo/lp7uszgZ6kxt0bNUDyWsU5kb/bS qb1KZy9zDevLM2fWbA2j+5/9iqDOJLaxgAV/p3KAcroZh3rg5a8fAOuKqPy8mygo9BvV NsgKAR8zX3jvPBpKtwrE/LAQcJ/yqDggmAn7UH8pKJsc8lPpzk/AYhC3AY3p9WlygsOa gaHRNUEr3At4TyEumR5j6AWamDJ72/oebZC2iRAuc++5yevgEKj1kSl+FdgcYMF5/n95 qTgQ== X-Gm-Message-State: AAQBX9fr7+JjW0W++T9L1oqJ3bRqZHswzXT5n8ju10sdUDMZX5GVjAG6 jQFEuzjvpVdcBimExJJFbNsL9w3wD0YWJ8Kh X-Google-Smtp-Source: AKy350ZXKLWX99WV75Zn5bhPto8WUfX5S0Ha1cMIMK8Z1sFTdLjrJB9JMxzEwgWixGxokt8xM3tEMiwbJzx2bThN X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a63:c49:0:b0:502:fd71:d58c with SMTP id 9-20020a630c49000000b00502fd71d58cmr3919025pgm.9.1679984216134; Mon, 27 Mar 2023 23:16:56 -0700 (PDT) Date: Tue, 28 Mar 2023 06:16:37 +0000 In-Reply-To: <20230328061638.203420-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230328061638.203420-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230328061638.203420-9-yosryahmed@google.com> Subject: [PATCH v1 8/9] 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 , " =?utf-8?q?Michal_Koutn=C3=BD?= " 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-Rspamd-Queue-Id: 31CD0180017 X-Stat-Signature: zhodqpkxm66tc3rhh13wndmc1os1pya6 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679984216-581932 X-HE-Meta: U2FsdGVkX1+1eSPj1y4BLQ29M3BC0TbHxmW7UlptEYUc72g8y0TPuT7GcbjRDcfS4YTSqmaKVq8x8X+jy39QD/TwvPYib0KaX51Qf0k7wBndW9yshKhVjriGH8xGGkPM77E6a5OZ+5mCeSRqMDw9/OwD/0SB9VmR/oURls2JMvq0NnU3hZR8gyaor5yoolkzu0JwpxH8kuMJ867kYU/ixJN+Rw8QFTu3AYT7RYRY9RyCM3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EEtHwLakfsUZ6f9TEV/vnJq+QPIyjHyjrEUm2SdLMXdD66keY6a0StDsoov/OuQC2vdQEZ5ReJUg2FKoIgHRR9puAuQ5MW5EYjimSqyOLOndpKagxI6iHmEqCiuyKtxufPMHP+mIDuDqEGpzKGfyW/jfT+vjIEyXr8FS4wFmAVUbQWe6pFZxtHo5Z43HY0M6PKvBDUh6jRfotSAT/04FePE616nDvCZZhVgmFIxh1sixNi52sv8FnRi5BftY1PEHFg5UtWHazM+8PG6J/LWqzFsmzUZdYdhWrV/OYMcFnqwq6rJB6aP+5UEiNSozx670H8zzmMWdsoaff4xqZ8g== 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 is 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 Acked-by: Shakeel Butt Acked-by: Johannes Weiner --- 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.