From patchwork Thu Aug 8 15:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13757855 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 819F6C52D7B for ; Thu, 8 Aug 2024 15:42:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BE9D6B00F7; Thu, 8 Aug 2024 11:42:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16E956B00F8; Thu, 8 Aug 2024 11:42:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00E276B00F9; Thu, 8 Aug 2024 11:42:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D7BDF6B00F7 for ; Thu, 8 Aug 2024 11:42:43 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7D7188140D for ; Thu, 8 Aug 2024 15:42:43 +0000 (UTC) X-FDA: 82429495806.10.B320DB4 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by imf30.hostedemail.com (Postfix) with ESMTP id 97D5A80015 for ; Thu, 8 Aug 2024 15:42:41 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=yOSSSUIb; spf=pass (imf30.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723131675; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=OoS5c7AqTIEc3lMd5dOxMQfYeBpBDya+0ZxkeiTfX/s=; b=yISMoZm4ijINkx6bB3xxfj3tjIvSg/Q3qxQ3OndSCQNViq2XyQ4NWpPEh0g0TseUk7M7Ee FsZyltV6h9Of1Q+IeWM6kt3g3MGwhHT6fVX85igKGRezaGdqrXublc++Xh1ZT83e8C755Y RIRT+Squ2yIYNrR5wM9e1Mdpjw3Au0U= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=yOSSSUIb; spf=pass (imf30.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723131675; a=rsa-sha256; cv=none; b=5cgF5iwF9sc9tzko7aLxyzDMSSKepuetXw71N9OvRrS9ZVwdj6ZNsejUmLodcoZ1yWHpUV klpfo5Zli6VVAThF0Ci8r7Jm3kqWkSA288r2rYr440jBsMWyVzwOAze+E+/CM5m11Ored4 cglsvhIL+bqG18C7eTg6xkRqoqN9y7Q= Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6b7b23793c1so6575506d6.0 for ; Thu, 08 Aug 2024 08:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1723131760; x=1723736560; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=OoS5c7AqTIEc3lMd5dOxMQfYeBpBDya+0ZxkeiTfX/s=; b=yOSSSUIbN0OZhvIeni0/AYno98zqGWdkzNpVAcclbDxYeyadYLdEYU1Fap0Ps/o0WV FCxCW4z3Shj9qFoBaVNU1s+TvX3rT56juOdTXnp5VG35KDF8ENfNiNwcIZJx9qMNaMxG ITh+ovBGey6gnoC3GkeaZxCWNAs9la2yqMvTn4At6wnjU9y37k52CNib4Z2jtYez3UeU Q7n/4h/yXGweB1jpWc60HBoKw4L+PBsZ66eqWlBRLA7C8VcV6/rLicsPlvgEXF+zsLw7 5XdKd6eMTVuZIkrLnliuW3uUg/e90tQhULxF+2oNVHGzJgZw/RquJOIaiWHbaIh1nrNB bakw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723131760; x=1723736560; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OoS5c7AqTIEc3lMd5dOxMQfYeBpBDya+0ZxkeiTfX/s=; b=pjaDG1fSR6zGeuY4JSRxMMB+2Wq3muq0MqztgdijqP7PiYhoutkGH7SbEB/s97Kbmx x43xOQmrtWkY4YT/Mpuj4eD2XOTsA7D67DqzrDSheJjGWtTH6OFtPPqru7v4X3vUlZUm NOSuBGjVRFJk0gs6CPqeqtu8Y4AfuUfOLlReNDXNwkBtRUP59we8Rbpaj3YK7EY2MAhp BkVWe5JpSw41Ibjw5JIosBZhe3n1GfTArjN8ILQfWDvKtnGlrnRl7fgKQ2ioKqrJbi6+ 68ZcYR/ywCfNEGk5Kl/lQbsHNmNa5TD5vmxe80K9yC7I+cID3y68guBJ5k62D4pkWs3O Yz8g== X-Forwarded-Encrypted: i=1; AJvYcCUAIFmDneo9JZwFO3GqUAn3yIbQQqdzSbgSestPH+u5VGCsFlRUX5NU0rXZTqY51dXUk/yG+IHNuv8Uw3KT0O0jmY4= X-Gm-Message-State: AOJu0YxGVw5Wsoih4HYkckRzvdFDMLNsNjKrmbh1T++nw511fBvl5vrD X1MlJLNltgfMtSi0nh3rlM4CIqPWcM9pqcvWVe9kXaN9xS/b7rERke1X56hbCZU= X-Google-Smtp-Source: AGHT+IEcL0yZePXhMPPsTPK8VSthHtq/oqJtvkGQFO/6miHrQpul5UYc/wo62QVWJrz61dTFYt0okw== X-Received: by 2002:a05:6214:4886:b0:6b7:99f6:98b0 with SMTP id 6a1803df08f44-6bd6bccdec5mr35072366d6.17.1723131760505; Thu, 08 Aug 2024 08:42:40 -0700 (PDT) Received: from soleen.c.googlers.com.com (118.239.150.34.bc.googleusercontent.com. [34.150.239.118]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb9c7b72d9sm67160936d6.60.2024.08.08.08.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 08:42:40 -0700 (PDT) From: Pasha Tatashin To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-cxl@vger.kernel.org, cerasuolodomenico@gmail.com, hannes@cmpxchg.org, j.granados@samsung.com, lizhijian@fujitsu.com, muchun.song@linux.dev, nphamcs@gmail.com, pasha.tatashin@soleen.com, rientjes@google.com, rppt@kernel.org, souravpanda@google.com, vbabka@suse.cz, willy@infradead.org, dan.j.williams@intel.com, yi.zhang@redhat.com, alison.schofield@intel.com, david@redhat.com, yosryahmed@google.com Subject: [PATCH v3 0/4] Fixes for memmap accounting Date: Thu, 8 Aug 2024 15:42:33 +0000 Message-ID: <20240808154237.220029-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 97D5A80015 X-Stat-Signature: zw8ahexfncowtm4hkhkxqeuartbf437u X-Rspam-User: X-HE-Tag: 1723131761-169540 X-HE-Meta: U2FsdGVkX1+sNtHQud3OOSZ/fPhgEU+JODucXmZgY1eB3z9PNwne5E8vfb/1VbWkgwL9HGaUw3cL5k9K0sdhvKrU9BQoIpsLytEkADratCYQc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ypivA4QveYwEfeVhyZP+bU0KrdcyNtE2ib0Pn1TVaqDEhVN0d25PZBeLF0QQmTWENEgkACzjAdYqUoaSqFMLRf3tPqFmM1xAuYffCgU5PYGyEkXNNptkeA7AG78IdYi3eW7W+/9nIEW3p5CeDLkcAK4QuxyZqoSWaXwmxrmkfrTLwAQCD56UqZ3f8GJCGk5h83Usny2E/YgiZsFitUSDVdpvYr7jA= 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: List-Subscribe: List-Unsubscribe: Memmap accounting provides us with observability of how much memory is used for per-page metadata: i.e. "struct page"'s and "struct page_ext". It also provides with information of how much was allocated using boot allocator (i.e. not part of MemTotal), and how much was allocated using buddy allocated (i.e. part of MemTotal). This small series fixes a few problems that were discovered with the original patch. Changes: - Added patch "mm: add system wide stats items category" - Changed from using system-wide events to system-wide stats v2: https://lore.kernel.org/lkml/20240807211929.3433304-1-pasha.tatashin@soleen.com Pasha Tatashin (4): mm: update the memmap stat before page is freed mm: don't account memmap on failure mm: add system wide stats items category mm: don't account memmap per-node include/linux/mmzone.h | 2 -- include/linux/vmstat.h | 22 +++++++----------- mm/hugetlb_vmemmap.c | 13 +++++------ mm/mm_init.c | 3 +-- mm/page_alloc.c | 1 - mm/page_ext.c | 15 +++++-------- mm/sparse-vmemmap.c | 11 ++++----- mm/sparse.c | 5 ++--- mm/vmstat.c | 51 ++++++++++++++++++++---------------------- 9 files changed, 49 insertions(+), 74 deletions(-)