Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp538758rdb; Thu, 18 Jan 2024 10:43:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMLbL8beqf7fv8RZt+oEOcdFaOUmpniPdxuVpHGua3XJOUbvDI5T+FoxJe9LLTtGhGDRXi X-Received: by 2002:a05:6a00:815:b0:6da:b57f:d4d7 with SMTP id m21-20020a056a00081500b006dab57fd4d7mr1721800pfk.35.1705603381528; Thu, 18 Jan 2024 10:43:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705603381; cv=pass; d=google.com; s=arc-20160816; b=rYWnfqGE8PqDYErm1LfmwggubsGNQ1P+6CZuak03/1wi0/HQiQo15UBkYmYWQjRPfz FFL+Zt6ICfOeE7BiAY1SBlSUcqizEaZKp+Fi2UsirfMXRZqzSLlt1w47MLjBSMqz95NK SGi85pgnhmpD+TokBUd5E187cfDdVsyhsAtpdYMUuEJFqCPSRbg0oyO0j4Cu3wuTBlPW bQUKN81Ih3oo4xkEFoxeoQQbgm6D8UcFu1SvfpSA3VL4J5iuY6oV6LrRozguQmWrW2gr sozGH82Dk1kiTb9Qh92YJfeSr/iFc8V55QQpibb8xznpCI6DWM7CJdqO4NjNTSlwaISN izgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=8yx3MHixu6Yr8K4Tg1W1xt8jDb7qQNzMKngP58qnPGU=; fh=IWg4HweW8D2xJb/nD8xn6+SW7haqAq70nKWVsm1m4P8=; b=JfprVS9PWUW9TG86knPmZXfcBubhsBwuUaryiS9YRchEGi9V5YOGwugvNjrS4BvjuD ExhijQXtqbhMsdQQWuP2tBPkUwH76ThLFC1MsO2OgAawyRWK2UzE8mRRotR09NBrzT5G EWXnBw9wbV1MIf5NgQaFV+DvN6x40UHmNRM2IHTkzAeOHU9CBaAreHA/kqTnNIao3wQL kMCkiv0DutRX9Ep45Tze/ZfEGQYf/ZnqjvEhEdzOZc4IVy6A5CFdRmcV95PiLX8enCMO fIGyOmmIscrE/6TeAkwSPQ2sEePffjNL2cW3rrKbxIWTZRBnWn/Vnv2WnkZApsW4h33B XgBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PMdtktRq; arc=pass (i=1 spf=pass spfdomain=flex--shakeelb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y3-20020a056a00180300b006db1136b362si4185848pfa.33.2024.01.18.10.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 10:43:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PMdtktRq; arc=pass (i=1 spf=pass spfdomain=flex--shakeelb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 22804B22931 for ; Thu, 18 Jan 2024 18:42:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9A432E3FB; Thu, 18 Jan 2024 18:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PMdtktRq" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 915C72E3E8 for ; Thu, 18 Jan 2024 18:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705603360; cv=none; b=UuvP7Zw527XQrO3dd7/5ZE8c7V4GoCM/1UeLBW4IpItTu8SmvcUb/Pm6ZcZKGudewMbdyQ/MGIrnCMgAdLOVG5vLc8mEFkNFZbIpxMjt1rroUrp1eeXVsaplSfM2dfSeUT2zoh7Ef4krhSYpqqsuQC5vul1dJcPswDuYITAfkG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705603360; c=relaxed/simple; bh=W6yWw85H3wm9jzeUaOrfwrwakFw21eVoOvO+YQYOBos=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=VzykaaTo0uMJxK8WsB+ZVVxlMSgDfIF2JrR2iTxGa0ujKipRExeFYnOwyLnPZCnmBoXq3d8xlANJy4ClXoRzyRLvVGOPSjLarBHx9BcxSV5e+R+2XXgiTOrxfBLLQXCwRkkRP7OGlTN3ApcAM3LbsMtic3rsAHRC+tNlxKrmEEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--shakeelb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PMdtktRq; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--shakeelb.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5ff481be48cso71088147b3.1 for ; Thu, 18 Jan 2024 10:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705603358; x=1706208158; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=8yx3MHixu6Yr8K4Tg1W1xt8jDb7qQNzMKngP58qnPGU=; b=PMdtktRqJ1Gnc8lPV2zXVo/ZhS+ldr3zp03yaAjH95umJCjbXJP8xiiWsDSXhKy0ZP moC4TnRUmtPnPz3nGJs32FW2Yx0Un/pP4HEYTHx24Ci2cC6irlQGCt94Ax9QGW/Ac+4x fiti05UZMmvwMEiSt4qv6OCggexdS2l1x98+wUxrR0g233ettGE6uI2uPXBQWBrwHiQx qsslHc2B9Q4uNtiivXI8RbMzsmZ8NGeChW9LdrPzEn7j6bpLLDoqWIXggweyv54383wb PmkHshRd7RkbU4xMrJY7tpZsd04fJ9H1NmIsYI+QSMJu498MA+sKBy3p2/ZU+E5rW7Ai z6+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705603358; x=1706208158; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8yx3MHixu6Yr8K4Tg1W1xt8jDb7qQNzMKngP58qnPGU=; b=YbtxzZIyXVYz0LQ60X9WXlymB0iFD8rFJyQpBvsLJyPYvhzmTUqIgWM0nXHJzjhl/I WfsPZdBKIqnvBedr0IHiFVi0JBZGl/20GoNm0oItIirSXTL17mMF/ArJKU4uUP7hHF7O DoOLTzHL+IqPWL0Dy+XG0ttzUbY1Bq+i8THMXgBGuH3n/w8xlOLJuOgmzb+reN5vTvBQ ePOdEuliztMecMiy+Ux16+hx9NwvmCmTv8aVOyFOUj85CtbjHu97X6Jk/4lR/CiPU4g2 lK8vaSS4w9HGpOOXcPAUmmGZVhpAnqgVyN+hWTIzRUMjwcicQwve+/CYBKQe8cyiXE8n bg1w== X-Gm-Message-State: AOJu0YxmM+TDzWTQ2ak6vIc9ZTdoBgmO3xFtb9vbGh5fPNdC/ZV4rEeq gBNHxZDeuuE+aWjUESb01K/bVLoXjDZyI7pf9kQf45+IZ7hHOcyWJTn+slw7ge6GwudZcSnPpJ1 T5zHBybfkOA== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:262e]) (user=shakeelb job=sendgmr) by 2002:a81:98d4:0:b0:5e3:fb36:ccb3 with SMTP id p203-20020a8198d4000000b005e3fb36ccb3mr584697ywg.3.1705603358687; Thu, 18 Jan 2024 10:42:38 -0800 (PST) Date: Thu, 18 Jan 2024 18:42:35 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240118184235.618164-1-shakeelb@google.com> Subject: [PATCH] mm: writeback: ratelimit stat flush from mem_cgroup_wb_stats From: Shakeel Butt To: Andrew Morton , Jens Axboe , Johannes Weiner , Tejun Heo Cc: Jan Kara , Roman Gushchin , Michal Hocko , Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt Content-Type: text/plain; charset="UTF-8" One of our workloads (Postgres 14) has regressed when migrated from 5.10 to 6.1 upstream kernel. The regression can be reproduced by sysbench's oltp_write_only benchmark. It seems like the always on rstat flush in mem_cgroup_wb_stats() is causing the regression. So, rate limit that specific rstat flush. One potential consequence would be the dirty throttling might be decided on stale memcg stats. However from our benchmarks and production traffic we have not observed any change in the dirty throttling behavior of the application. Signed-off-by: Shakeel Butt --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 935f48c4d399..2474c8382e6f 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4776,7 +4776,7 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css); struct mem_cgroup *parent; - mem_cgroup_flush_stats(memcg); + mem_cgroup_flush_stats_ratelimited(memcg); *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY); *pwriteback = memcg_page_state(memcg, NR_WRITEBACK); -- 2.43.0.429.g432eaa2c6b-goog