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 50D83E77188 for ; Fri, 27 Dec 2024 00:56:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A061E6B007B; Thu, 26 Dec 2024 19:56:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B5246B0082; Thu, 26 Dec 2024 19:56:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87D126B0083; Thu, 26 Dec 2024 19:56:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 685D26B007B for ; Thu, 26 Dec 2024 19:56:15 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BACCC80399 for ; Fri, 27 Dec 2024 00:56:14 +0000 (UTC) X-FDA: 82938920694.08.A3DDB94 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by imf07.hostedemail.com (Postfix) with ESMTP id 8968840014 for ; Fri, 27 Dec 2024 00:55:00 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=fn+Jn6wa; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735260953; 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=xmg9031oBU+yNDO8om8qf1pVDLfYewKveF6+MqKOFzE=; b=axCi8sckEcuuQvqtL1Kicmn5JeU5xofz2XNhxHbwkO8HFm8esGvX84oKHgVH7lpU2UVorS Ka8Z2O0FrV+04mjeySXMggkaMGGpM4rn5ecIPZYoYXGEv0R4KOfcb8wo+iJqiAUu4sl5Gw Kn5BxxfMUDGPgkY2rLgd1ri2KvZC8OU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=fn+Jn6wa; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735260953; a=rsa-sha256; cv=none; b=RRZdI+aKV29BbbcEs88QPPeMd90wTMgg/X9HeCQqwXglinRBbtr6K5/phfm/nPZ2tLUnkG izwp888LVkNK5PMqcZFSw+zx1mGCtVWDLmKhwP0hBsN9x6ngLRdyMcNYuUoO7sSEHVLA8t Q3gC01zM9pQ1129Wla3vYkDW6tqRTOM= Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-467abce2ef9so1776821cf.0 for ; Thu, 26 Dec 2024 16:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1735260972; x=1735865772; 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=xmg9031oBU+yNDO8om8qf1pVDLfYewKveF6+MqKOFzE=; b=fn+Jn6wa3wZ7IeGJMhAnpUhjyKe1nFaoFqTmhqOzfG88K99/JMLhJOM3oG5q0zyEWR hLbIi0SYH4Ag2rkf8R/KmemKFXW5F+BBnmFKMQIw/Hx0crnUeR/GqINxUpTIPMhpoiF1 /B9MbzC99CfpESt4WNv2HKh5csK4SjaSLuRMSR4WionV3lb8dUCmSOfA3zndafFn5ZyI Y117AmW/sxwWrSXQixULa1Gxy9lZaenoAjwq56flwtZ3LWesl+KK4QrdXSNmJDnDAoiY hDRaqxcqcBf0RyaWvdnQkBWGOxTlM5d423WdzYADsy7/gSivtyi/KdeqoP59BLVQdJsL zZTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735260972; x=1735865772; 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=xmg9031oBU+yNDO8om8qf1pVDLfYewKveF6+MqKOFzE=; b=FbdyY79Qr6mGeD0FFIC/y4i/EBhhTKDFaqX+RCmyOyIuNCJmviOnUTRh/FZv1qTIDl prFHrf5Z9gZxhcTwD2gMeOU4QyHY07o8/gVdv0jBoHNKMWyBbMRtHwJVXVGUwXHbuKOr iNDq6t8MYFmcPiIv7z/Mwvtl+BYTvSk06P8TbYC+KiVpYrZEk6WWRA15Sg5PCmddxtPJ hxcpuzATclf7eyrvqcqRV9sUav6A/oMi7Y5aSrukXYE3t+pGw8yxLVw0ArEhnPd8Go5v bEi3ioHeFrmS0RmMZL/M0KBjRntb4R7le9Y02gxsqs3pWaulcMe5Oy4M7P+xrDHIKjoA WdiQ== X-Forwarded-Encrypted: i=1; AJvYcCXpbfKkKjPVNdCGhGBA9KfmB99aS+mSEoO2vmUA1E1mhqEb7iyiSNhKiyePxUbdJ1h4MBoRssUEOw==@kvack.org X-Gm-Message-State: AOJu0YziED3mWb/v50PpEiEtsgI7BQnwpFqaSbPGFEzcXrBbt0IX9JDU 2Za9hMyWcBgaYYQAQp2dAdUU1E3dM5T8CwtJDcajEkZuDWQQlseoExQGhntr6ZJrOKaBHI+q7/x QjO2onGyaJWmzNYNF1JXICypun0kwXtQRDpiO X-Gm-Gg: ASbGnctKYr75MusGnNkpUAmdojrb4jpMgXXm8XxazIlN17HV9CCBggtQNeK52v0fx5l udWP8O4wUgz5FNiPWTY+vw5L5fGcrixmrWd4/qQ== X-Google-Smtp-Source: AGHT+IE4iBoGsKtdMKjCFLQm891+4egmnOR4DRE2hqUqWLpwgabRAeOBJZAwWAV6byblgHFXNdDL7AWbg7J8AKXniIs= X-Received: by 2002:ac8:5f4f:0:b0:467:462e:a51b with SMTP id d75a77b69052e-46a4a8efe30mr17834661cf.14.1735260971638; Thu, 26 Dec 2024 16:56:11 -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> In-Reply-To: <20241226162315.cbf088cb28fe897bfe1b075b@linux-foundation.org> From: Suren Baghdasaryan Date: Thu, 26 Dec 2024 16:56:00 -0800 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-Rspamd-Queue-Id: 8968840014 X-Stat-Signature: qip751uc16edxb9giy38rr6syjz5mb8y X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1735260900-585145 X-HE-Meta: U2FsdGVkX1+yGZ3K0Bugu03j7n7rogdXt7m9hgGwZQC/7rJHZsy3k9Ne4QhHFguv91zkH8r5+QNo/IwXxQcVBMkMVx3yp8o4PS/bwuWaHP8/qKbbjoRJJcRA+7m7CxpjDrZNMPmDBu3+mkWanxo08aKvZLZvZWD8Gc2hKnGkk4lRS8A//u32R/nTjmz2aO5drxVwqc7Al/4psjrUwii3ziJYB5WS1AcNX1GhPKRDgRkgHHl1qlJeqOBvfukM55e3aLTF/CBi51lPRdg+uNI4A4NQ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=0.014373, 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 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 need to s= wap > > > > allocation tags during migration. Skip it to avoid unnecessary over= head. > > > > > > > > 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 much > > > difference the patches make would help people understand why we're > > > proposing a backport. > > > > The first patch ("alloc_tag: avoid current->alloc_tag manipulations > > 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. Please > 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 instrumented 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, the overhead of the mode when memory profiling is enabled but turned off went down by about 50%.