Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp136047lqb; Tue, 16 Apr 2024 10:51:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZu94awHXHAcXjpPUFVmFrM2gPLcRE2q+fqesWkjtpXF0haIrEGdCQXdfB2STAtFZgbic5XyFqMWoC0QI0aSflsag1RVLS2xG4X+OyUQ== X-Google-Smtp-Source: AGHT+IEvzfM2doNiTP/oxEdIV3CYbx6TpRfRpTHZZkaUp/vo3BPDhSQfvQPJ1Sq0xtpd2dB67t2r X-Received: by 2002:a05:6a00:2308:b0:6e7:3223:4556 with SMTP id h8-20020a056a00230800b006e732234556mr13537575pfh.32.1713289897795; Tue, 16 Apr 2024 10:51:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713289897; cv=pass; d=google.com; s=arc-20160816; b=AA/RSEzhCtxe2gpeYyDF6EaTQVaiPFWHunlfWMWF/ayWPpDYn9SYSv6qypuuaF+41h UDnUM3PIAXRQUWLj/lBwKjx87DI10DjQuLiDCf0z5gpQqJ8bszQ/IDQnRhegIASlMPE2 aB1p49cZMBq+NNgabjEWxXx5lv2jMiRbFJtSAAnyQGYI3zU7q82L6PsOLY79DCReZzAg k0bJTyIb/bLBXWo7oxhxYoD20Le9/ibWgAuP0efcDObaLqgcGdsfBE1ENYklzuwjF5aH o5GiS5d6uXAduRDS42yVz7PN85NcapHJnbMeHkC45JmEuwrS5zOqA7Na3VYaqk91cbzK 6JsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:date:cc:to :from:subject:dkim-signature; bh=oEWKmCtUb8giZahChZ30F/upfJjYlK9V1G00405z+Tw=; fh=HqT9lx9w6ka3SLF9nrNYmi/Di1aqUohn73DGIJTFjfE=; b=bDQYEhoxs/8ijJbR7r/grEqDGftSXDfeitE9R1AiqDxH8FWcKiFDGEGeSpZy6CnHEQ 3ziId9DRgqc7UCIpJnPgXnGBMxapPg1Cgpal4Sr4A+EWjhSJfS3WYwgDdBzslgrwDwbj +x9d/apjxBqxVePPNYVOFq24JktxHFG/7mF7hRM9z6tw0WbFLRWmkassza/ZyfUt0hL4 xDhfcmvCQKe762wBXlrWcOYKxvYYHt4YXiLU93lp1EitacolyBb6j0nOB3Lv8Pltmuxx DMisGLN49Crl6XYIRXM8nR6fOaKtpv8rrDDmvyRBgMqukvxOwhoGruJJgopzQyemlfyk ZJqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FAmSAcR6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-147333-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v2-20020a655c42000000b005f42e08ab46si9826288pgr.456.2024.04.16.10.51.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 10:51:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147333-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FAmSAcR6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-147333-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F4A6283D1E for ; Tue, 16 Apr 2024 17:51:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C32C13441E; Tue, 16 Apr 2024 17:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FAmSAcR6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7CF512EBF0; Tue, 16 Apr 2024 17:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713289885; cv=none; b=l+iMg7fUoocKxFUBEfiy8MeAl+tq7ZsrjJzideV+G42B/NzPBNxkRcoEfhg1G7i1/+FihHYBwE4Zl4K2gLBEd1KSUt4irsNVHLnPVSoGjrcxmlrpfureKBUYqGc+Icw5WS2Cuh4yu0m4hEq4lABkAedfioN8wt2EW1R0GgQ39TY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713289885; c=relaxed/simple; bh=bM4xJrevzHisjJsEBCKMA21c1+HdvIZqUoYp2jCPlJw=; h=Subject:From:To:Cc:Date:Message-ID:MIME-Version:Content-Type; b=aZUS60I1x8OWj9ek0ewslWoqSa0bQhGCxTzZU5VLJmuNdi+OopaCZMVMJv/vy4/8cjVQuLkXrOELSb2/vN70jY5xPWuAbdLVNt9ZkOz1da5KBe88/0T2178S+ltRip/3HoWTsrDdoaCE9HwWwZFtuQwxZgeRSEbQir2VcRsnNBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FAmSAcR6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEECFC113CE; Tue, 16 Apr 2024 17:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713289885; bh=bM4xJrevzHisjJsEBCKMA21c1+HdvIZqUoYp2jCPlJw=; h=Subject:From:To:Cc:Date:From; b=FAmSAcR6ed3Fi+OIR5DzruE8DSs+YfuciiT/vPtdTIR08H4t8Vx9gAqgaWFWagxOQ gJW4+sL1iz+m0xWQtVZpMl7RIW5S0ufVGcXMGJZOdU7dmCzn0X21tdcFljjJ6XrRlM xjmXTs6bUj9Tvrz2bo5yUPQjnruWastd0fcH97gH/DgUEGy2NoEtP6IIos+FZp7++4 ccmzDFNPzkTRYfPIs3D9h5LIvUZPKsz33aMHRSD1DfGVNNucW9AAuMClftZvfPEYYA rF3SqZSlqtRhExXS6EUYr3IfizqJ5W5nND9fgkb48e74MFsdtYEFE80+yd4x9d9sZL DRkygFoJbUvog== Subject: [PATCH v1 0/3] cgroup/rstat: global cgroup_rstat_lock changes From: Jesper Dangaard Brouer To: tj@kernel.org, hannes@cmpxchg.org, lizefan.x@bytedance.com, cgroups@vger.kernel.org, yosryahmed@google.com, longman@redhat.com Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, shakeel.butt@linux.dev, kernel-team@cloudflare.com, linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Sebastian Andrzej Siewior , mhocko@kernel.org Date: Tue, 16 Apr 2024 19:51:19 +0200 Message-ID: <171328983017.3930751.9484082608778623495.stgit@firesoul> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit This patchset is focused on the global cgroup_rstat_lock. Patch-1: Adds tracepoints to improve measuring lock behavior. Patch-2: Converts the global lock into a mutex. Patch-3: Limits userspace triggered pressure on the lock. Background in discussion thread [1]. [1] https://lore.kernel.org/all/ac4cf07f-52dd-454f-b897-2a4b3796a4d9@kernel.org/ --- Jesper Dangaard Brouer (3): cgroup/rstat: add cgroup_rstat_lock helpers and tracepoints cgroup/rstat: convert cgroup_rstat_lock back to mutex cgroup/rstat: introduce ratelimited rstat flushing block/blk-cgroup.c | 2 +- include/linux/cgroup-defs.h | 1 + include/linux/cgroup.h | 5 +- include/trace/events/cgroup.h | 48 +++++++++++++++ kernel/cgroup/rstat.c | 111 ++++++++++++++++++++++++++++++---- mm/memcontrol.c | 1 + 6 files changed, 153 insertions(+), 15 deletions(-) --