Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp58990lqh; Fri, 3 May 2024 13:19:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdP5vroEMRZhtGyKCZari9sk/9knScCF9qhh/tSIlNtgK4PkRmgx7qlDy/bVo+aMmxbpRtHUll8iEBzjE2x0BYCwM40Xx0NxuvKQPXdA== X-Google-Smtp-Source: AGHT+IGYPpzZMS5NP9kNX72lH5ZoN31gM6MX06RYRqgvQ9xHrwkq1IKsaEW7UZkpbImyX8xkRLWk X-Received: by 2002:a17:907:bb86:b0:a59:9edf:14b8 with SMTP id xo6-20020a170907bb8600b00a599edf14b8mr794239ejc.3.1714767544323; Fri, 03 May 2024 13:19:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714767544; cv=pass; d=google.com; s=arc-20160816; b=wIk6h+kSbW6s8ZSGHYDp5OvQO5UwhYawkykE9ewwi8osSHrGvzcs3M65H32Zw2e/s7 VAGpLpSZaoQLnFcZdDoU6/PTn8fGNPJl36diyh6b3whCyeGoLnwA9EGM4SU/WKlJbjtv zG4gdvO89MNZSeA/HT2XnmWm1vbNKlJZ4SCICNLc/+5kXBjy79bsxFWFQ+jFajimxUfk lk+dIyH/H+ON+e4x0bq/YPfLv9Wvh3ikQoJLK0gUx46Z/9lsGu1Usbt8Thk4FlSAvOnN kSYYZNo3HFCqueK4DP4H4w07+zJPC95xLyWwSQgaRNvNblO36T3QrqnFQomi71jnNhxX 4w3w== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=whyY/54/aEMpx5QqbHo4KZGYlopTSjkO3yuzR2BqPnE=; fh=TNDMDPdIbKo0iVTVKQ4EX5/pyYFSCfE48iEvBD2Vogc=; b=xmtyTnWw7J8HS4JfFYapmYS3iMZdfTeVxTkzKZpxGgD+5ttUTKTUkRzsL+ijYJoVuO hNqSZRcd1AvIjzCN2faWXdjBuqr2QpjAaqImqI8M8KaW5v9z4iPgiJYsb91JC3S1OMBg Kr9z7k4beVqfH+3rnh/cgnNfNmtKMyQQvOM7SmhfDX2QFZzk0rcvSoEXZ2Jqd+sBYvz1 Ey0yQOhirDpTAJcyMT23qIJdCgbdxiqr+qAbl5K6HrLchzI7oq58uoByl16OjOrSX6nF 9VHdWzW+sFmcxDx+8V1LJIQXmJjvS7ivMyepWbmukUE7SUQTe0OlL51BBg9H6hgfjkuv +pzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Stl6nC4P; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-168168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v11-20020a170906564b00b00a599334b1b4si861903ejr.881.2024.05.03.13.19.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 13:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Stl6nC4P; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-168168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 11F801F2408C for ; Fri, 3 May 2024 20:19:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFB82158D99; Fri, 3 May 2024 20:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Stl6nC4P" Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 4628C1EEFC for ; Fri, 3 May 2024 20:18:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714767537; cv=none; b=WfGtnaaK9g2WRRTUOFGFEwDbmVwKADkb/ZDjTcnzzwWV+LUdKp2JNFDPzRIpmcsTzmOWcOlI3ZRmM606UE5TLRSyJxUALSAF2j92zjdvjMrCBweINHkxy+skRlDxDQU4gMLNtunWUYT9bXdgZG3GMNziNALpGqI9DntS8NdUSCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714767537; c=relaxed/simple; bh=yPsEkE9UBURZMaSpqjXYyhSUcV9YQkoQwODCLagkODU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=T39G1vhzfk+HO/DzHYntocuCi4LkF+Xo2gvkj5efhIZu1P9a3eeHoL9S0iYPdloNyuvChqV6LJKCWDbpcdtoiG6gZswqnUz62M6D64vO0JMPOcTWu3K5YPIQQ0yMgFWTAoqApm+XC7xFtZMlpgVY03b+fO4PWjNaP1XcOPglZ/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Stl6nC4P; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714767533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=whyY/54/aEMpx5QqbHo4KZGYlopTSjkO3yuzR2BqPnE=; b=Stl6nC4P9JH81jEBtgJ1Uvd5DPebTaJnXE7rBafCY38mdOljymNTKUjrmUxa4tp58PccsH MR66i0b4iWBhMDLzs8Zx9xx7+s8xepnYaXcBE6JCXODevtgXP17pViEliibT0R6q8gCbh3 36ik/R6520s/hx1dDplKeb8282QNg1M= From: Roman Gushchin To: Andrew Morton Cc: Muchun Song , Johannes Weiner , Michal Hocko , Shakeel Butt , Frank van der Linden , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin Subject: [PATCH v1 0/4] Page counters optimizations Date: Fri, 3 May 2024 13:18:31 -0700 Message-ID: <20240503201835.2969707-1-roman.gushchin@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Roman Gushchin This patchset reorganizes page_counter structures which helps to make memory cgroup and hugetlb cgroup structures smaller (20%-35%) and more cache-effective. It also eliminates useless tracking of protected memory usage when it's not needed. include/linux/hugetlb.h | 4 +- include/linux/hugetlb_cgroup.h | 9 +--- include/linux/memcontrol.h | 15 ++---- include/linux/page_counter.h | 88 +++++++++++++++++++++++++------- mm/hugetlb.c | 14 +++-- mm/hugetlb_cgroup.c | 150 ++++++++++++++++++++---------------------------------- mm/memcontrol.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- mm/page_counter.c | 76 ++++++++++++++++++---------- 8 files changed, 340 insertions(+), 367 deletions(-) Roman Gushchin (4): mm: memcg: convert enum res_type to mem_counter_type mm: memcg: merge multiple page_counters into a single structure mm: memcg: don't call propagate_protected_usage() needlessly mm: page_counters: initialize usage using ATOMIC_LONG_INIT() macro include/linux/hugetlb.h | 4 +- include/linux/hugetlb_cgroup.h | 9 +- include/linux/memcontrol.h | 15 +- include/linux/page_counter.h | 88 +++++++-- mm/hugetlb.c | 14 +- mm/hugetlb_cgroup.c | 150 +++++--------- mm/memcontrol.c | 351 ++++++++++++++------------------- mm/page_counter.c | 76 ++++--- 8 files changed, 340 insertions(+), 367 deletions(-) -- 2.43.2