From mboxrd@z Thu Jan 1 00:00:00 1970 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 40B30E77188 for ; Tue, 14 Jan 2025 16:38:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84CF76B0089; Tue, 14 Jan 2025 11:38:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FDB66B008A; Tue, 14 Jan 2025 11:38:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69E2B6B008C; Tue, 14 Jan 2025 11:38:52 -0500 (EST) 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 4DBA46B0089 for ; Tue, 14 Jan 2025 11:38:52 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F28F61C7BDB for ; Tue, 14 Jan 2025 16:38:51 +0000 (UTC) X-FDA: 83006616462.16.C4E1FC6 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf02.hostedemail.com (Postfix) with ESMTP id 2669680010 for ; Tue, 14 Jan 2025 16:38:49 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="awXu/mGH"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736872730; a=rsa-sha256; cv=none; b=7ztFu5hJU8YviNUck6qBRe+U0vHa3WhWkX5U9MAPt1vJWRMrpcinGq6T2Nvb4yNBvxLYEr VG/uHA8dc8Lb3WQbBnwZ99R5O8xwl05DlP/i78c+kwIbNXZIWh2juDLfSvllJ01l7zU7XN G1Afe2g1dMainbp2/jX9rsHmm5LtNcY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="awXu/mGH"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736872730; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5PExLh+VadLSZ/QEUDqe8VtyDXluJrgkbId1fgASES0=; b=fC6a5EUVzNTlFHUlstlHXC44QFsAYG7nyhDKRLLqSXnDZf0bSFAzn/6wceVwGMxChLA/fY ESgEklRPGg0GVdSQuusBG43SEIMr8/6vbCpgmNzKtUxzR5qbxlU14jWb2ysx1E42YCGP04 7kd7bGtZDzDO//mnOdi30ThT9srH7gQ= Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-467896541e1so289761cf.0 for ; Tue, 14 Jan 2025 08:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736872729; x=1737477529; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5PExLh+VadLSZ/QEUDqe8VtyDXluJrgkbId1fgASES0=; b=awXu/mGH4QbO06ZXS33w2ZVZyWrcGQxGIbO2hGUeEuB+Zjaz+gwSRz+3q4mWZ88B6s 9XUK8npX3OFiG7ENlxk9iswnz5vhiWW5rnuXCT+ey9oTG0dsApEFQCRLlA70FCCu3vjA E5Xh0ROPEEMC7O8yIuiqLyW0j/hzTWOAFfJROq9QCusNUoR0B2Eux63ZF4lWNTXIe/E4 VXJhImxmht9AnsTKiHFXM6MpS2b3FrGhT3jcBunevp1DUQJ2IMGdThSbzGwLpnhE7z7G dtQPfdVOPeZcRrqaCfr5gJo5OoIzuJ+QQI+5a0FB0BOLxoJSXkVhVkGCgEGxklJTLgHX vl0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736872729; x=1737477529; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5PExLh+VadLSZ/QEUDqe8VtyDXluJrgkbId1fgASES0=; b=PoigllWW2CA9JN3a1VrqCls9DjjAUHpHnaqI+OziRoK+WPRYhWaWhn5sK15n4Zffqo JrUBbriE/KXioRqpVtVtFPUnfq0kgEVqu96j3kBCXIR0a5u3VVy1PCIbeQwNj0P7kt65 y2ltEa7+Fl6rbwMuhdvYxkMEzds2a5lpUyPPoBsANJA/H/Tk0f5HnEVaPMeGKoqjy8f3 YuQVP9V8os40kjPWIN00tM8ysIBT4VjQAMXoB6AyDtB6S2yS7+690fdC6Em8g5ejHoCR 8spWzNTUixH6xQFyS1bblmyd8gm2Z1rufBXptKevG54pnnI69hNDakTp/WVS1/wHDhXN dmTg== X-Forwarded-Encrypted: i=1; AJvYcCXoX+Oe6i1GR3kZ6lP7JLqnltsULY6C8wQRwbBWIVKRWYiH1thfFYDY9V8QY7ja+OQ+x4eT9FFPeg==@kvack.org X-Gm-Message-State: AOJu0Yx5Fbry7BXo/85pfQdvROw4xjDavxQbOh+zqTTrDRH2slWzVNOM xdkHMgABCauUJdlltYdgGnC9XN5X/9J9evL3Zb4coWYuEQDYouhFvmWa5rIiZwfZZco8iC62rbz HPSfp1JOFcC/8dGRFUk3j1edNdcstEeCep7pN126rysYqTncOOV6t X-Gm-Gg: ASbGncuPtcl7HroQ/l/gEBE7PXr+yVNfeT6cme3Uokp1joDAM1NquRWlWhAR6v+vcsb V+sDmiLQTYHU22G4E/AH6cVmOlpU0uKAIKLEXjhQOjWCAliJwioV4qlG0G56hxBC/ncNQ X-Google-Smtp-Source: AGHT+IHULoMHUVr5U4+2d4sGP84Mlu3dznQTDIXfUSL5YZ711SpqNbK8AfpZrJprp8DDA4JlPKfMeP9NWf0hutEBxTs= X-Received: by 2002:a05:622a:15cb:b0:46d:e5e1:4087 with SMTP id d75a77b69052e-46de9804f4dmr3293771cf.4.1736872728965; Tue, 14 Jan 2025 08:38:48 -0800 (PST) MIME-Version: 1.0 References: <20241226211639.1357704-1-surenb@google.com> <20241226211639.1357704-2-surenb@google.com> <20241226150127.73d1b2a08cf31dac1a900c1e@linux-foundation.org> <20241226162315.cbf088cb28fe897bfe1b075b@linux-foundation.org> <20241226235900.5a4e3ab79840e08482380976@linux-foundation.org> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 14 Jan 2025 08:38:37 -0800 X-Gm-Features: AbW1kvbnlQb82XrF-Q6CEpwNlX1U0rhXcc5wFoFd5lawM3uKO28GFhJAoLV88cw Message-ID: Subject: Re: [PATCH 2/2] alloc_tag: skip pgalloc_tag_swap if profiling is disabled To: Andrew Morton Cc: kent.overstreet@linux.dev, yuzhao@google.com, 00107082@163.com, quic_zhenhuah@quicinc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2669680010 X-Stat-Signature: metp51re3t7rwwzzeuaehw48tua33f94 X-HE-Tag: 1736872729-283643 X-HE-Meta: U2FsdGVkX1+CwavMZe3Ln0UKZNl8B6++CNM0XzeOHBSvc3haWQ4ABYXOMnlRSInPuXIgEnkaeTFTB29xlVRDVb/jg+z+L2QpeNnCVhePTikZWZneC3uokqunNu6QEFR007EXki4dJmBp382zgSdX3xd9RMjzz9ceZTHpgi/lyX8wZW+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BwKXZUihN5rC+YRoEn/qR4srQvQTE104agkr3IpIeR3AKZZ1VLrGnE7hYpxvd4sniBb0jujJAyuebn2mNFPwg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000031, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Dec 27, 2024 at 9:28=E2=80=AFAM Suren Baghdasaryan wrote: > > On Thu, Dec 26, 2024 at 11:59=E2=80=AFPM Andrew Morton > wrote: > > > > On Thu, 26 Dec 2024 16:56:00 -0800 Suren Baghdasaryan wrote: > > > > > On Thu, Dec 26, 2024 at 4:23=E2=80=AFPM Andrew Morton wrote: > > > > > > > > On Thu, 26 Dec 2024 15:07:39 -0800 Suren Baghdasaryan wrote: > > > > > > > > > On Thu, Dec 26, 2024 at 3:01=E2=80=AFPM Andrew Morton wrote: > > > > > > > > > > > > On Thu, 26 Dec 2024 13:16:39 -0800 Suren Baghdasaryan wrote: > > > > > > > > > > > > > When memory allocation profiling is disabled, there is no nee= d to swap > > > > > > > allocation tags during migration. Skip it to avoid unnecessar= y overhead. > > > > > > > > > > > > > > Fixes: e0a955bf7f61 ("mm/codetag: add pgalloc_tag_copy()") > > > > > > > Signed-off-by: Suren Baghdasaryan > > > > > > > Cc: stable@vger.kernel.org > > > > > > > > > > > > Are these changes worth backporting? Some indication of how mu= ch > > > > > > difference the patches make would help people understand why we= 're > > > > > > proposing a backport. > > > > > > > > > > The first patch ("alloc_tag: avoid current->alloc_tag manipulatio= ns > > > > > when profiling is disabled") I think is worth backporting. It > > > > > eliminates about half of the regression for slab allocations when > > > > > profiling is disabled. > > > > > > > > um, what regression? The changelog makes no mention of this. Plea= se > > > > send along a suitable Reported-by: and Closes: and a summary of the > > > > benefits so that people can actually see what this patch does, and = why. > > > > > > Sorry, I should have used "overhead" instead of "regression". > > > When one sets CONFIG_MEM_ALLOC_PROFILING=3Dy, the code gets instrumen= ted > > > and even if profiling is turned off, it still has a small performance > > > cost minimized by the use of mem_alloc_profiling_key static key. I > > > found a couple of places which were not protected with > > > mem_alloc_profiling_key, which means that even when profiling is > > > turned off, the code is still executed. Once I added these checks, th= e > > > overhead of the mode when memory profiling is enabled but turned off > > > went down by about 50%. > > > > Well, a 50% reduction in a 0.0000000001% overhead ain't much. > > I wish the overhead was that low :) > > I ran more comprehensive testing on Pixel 6 on Big, Medium and Little cor= es: > > Overhead before fixes Overhead after fixes > slab alloc page alloc slab alloc page= alloc > Big 6.21% 5.32% 3.31% 4.9= 3% > Medium 4.51% 5.05% 3.79% 4.39% > Little 7.62% 1.82% 6.68% 1.0= 2% Hi Andrew, I just noticed that you added the above results to the description of this patch in mm-unstable: 366507569511 ("alloc_tag: skip pgalloc_tag_swap if profiling is disabled") but this improvement is mostly caused the the other patch in this series: 80aded2b9492 ("alloc_tag: avoid current->alloc_tag manipulations when profiling is disabled"). If this is not too much trouble, could you please move it into the description of the latter patch? Thanks, Suren. > > > > But I > > added the final sentence to the changelog. > > > > It still doesn't tell us the very simple thing which we're all eager to > > know: how much faster did the kernel get??