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 EC308E7718B for ; Fri, 27 Dec 2024 17:28:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5558A6B0092; Fri, 27 Dec 2024 12:28:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DE166B0095; Fri, 27 Dec 2024 12:28:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 357226B0096; Fri, 27 Dec 2024 12:28:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 150006B0092 for ; Fri, 27 Dec 2024 12:28:51 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A5CA0A1C49 for ; Fri, 27 Dec 2024 17:28:50 +0000 (UTC) X-FDA: 82941420996.17.A2AEC7E Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by imf24.hostedemail.com (Postfix) with ESMTP id 2C049180007 for ; Fri, 27 Dec 2024 17:28:42 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hefioR4j; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of surenb@google.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735320488; a=rsa-sha256; cv=none; b=dQRqEU63xk+fiR+6BaLp/GyCS6Z7TFN2hcSdTzV9qlDb6EdGaTMRaXAqF4RvFLVUbzMJI9 pUF1fPi78D7LXvtADSJc0mz2sQLvMti3cCXA0JWc23LvGCmzCFPF+YUOPXQ+lC3BEvEvpu YNGOzMN3aDFXTYLkhzXfO6rNWqunoyQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=hefioR4j; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of surenb@google.com designates 209.85.160.169 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=1735320488; 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=KpCKjMyoJFbHMCmkJCoptr+HQTE/8N0QQxukHE9I6Ro=; b=BUl8Iv9F0c48vsUC9uG8gA37h1oUvU3AGZl8LFvy3sZZxrE+VmSvSL00moBapuEDDHCgbp CKrsqryyb+BduvnKOePHIMApoHaaGg1AawDl1K+B74edYLHkkJYGhGogn6jQTNCy22z/rm VCQygkRynNJSud6pNWx7wSD2Pd1O0ok= Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4679b5c66d0so1883041cf.1 for ; Fri, 27 Dec 2024 09:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1735320528; x=1735925328; 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=KpCKjMyoJFbHMCmkJCoptr+HQTE/8N0QQxukHE9I6Ro=; b=hefioR4jdYCfYBNw1+pbMx3ogHQ/Tu3tg4H5nF/qsa2LFmTmzKMHGEngn9s6Cs1gdo UXPEZPxShlkXYWE81rhGek888fA0fifa6TY5bniuESH/BXZ0VLDoNfN1Ok7zbqlZwe6e SoCocv8+DXHO3oCrJqyE6QfZe2gCvD6L/hOy9cuaHUXoO6a/Yqcf4ZzQVNaPOhaJHFyz fEKyXXP66Z7D9YBl6KZoXOH7Y905LswywcKb5IhVr+xorg1J2VNJ5oeONfFwIXRNwagk 8BeRG8VY8QzjsHjtR+d0Sy2h6o/9swZQ+AnX1IB/75iwd52VV0aocx3B+uEyI8QNuk1v jCuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735320528; x=1735925328; 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=KpCKjMyoJFbHMCmkJCoptr+HQTE/8N0QQxukHE9I6Ro=; b=gU3F2v57USI/8h/egcZq8uulPaKKhisxameEPm8Mx+nkDD8Tsgj6rI5zAlLiQDcEuI uxPybSxkKikgrRjNsw64f6QpGfNhm7vz83PoFs/tCxOxuDkPpgPzRerIm3xOp8UCaUP7 iZWf450r+O4O4/4CfgSisCB7s3/AGfvaqvDf/E16OZo15a5Oe9Vja3oBSe1/5TAYTc9t xgnGJCd+0DP/UCRh1Nk1eVOuLdTvdLVNprKdqjEGNgpM6X0qxz3AhTTMvrfJW3q1ZQUn Y10PXE8Inz5i31MbqDD/xyU2BbP1z7+T3LzInoRC8Pi3I04AAaNddBUrCjpNZ0iyiFfa CDdw== X-Forwarded-Encrypted: i=1; AJvYcCWoNIlPPt5U+xEiXRzC61RoGXB00XLotJWxYTvleqCThrmjKBVihYGqz4c9sOEqZjbSlMD4hhhkkQ==@kvack.org X-Gm-Message-State: AOJu0Yxxt194oB3ek/t8L4ql38m61tT4GKVLygMhQjVsBdmaKUCrNIVp lTYLvlm9LYHEnCO2AApjXzNXU03mSuTcFk/5JcxD7qV0JaQKWSOmM7JLohHLVBZjx0lkIG0OXy1 zYf+1zQR30VW2IVfZEC187mzYyt8pYYjIFdH6 X-Gm-Gg: ASbGncuP0BpYHbqtBen5PL9aCs/NtPHe9n7GLMz0wQSmeZPnWh3ApQbZbEfB47OgKlK V3kLF5RPHk5Ecet4DyDe2uniI9azr2RRBRyXpSA== X-Google-Smtp-Source: AGHT+IHXJ9qnlcknbZgTfwfnqxYMBtpCb6XoucoAKBV2CWfPidzPtEvqga3s4/HDaXdYSAmQ3MqzuRVNN/1m3MYP72c= X-Received: by 2002:a05:622a:18a8:b0:463:6fc7:e7cb with SMTP id d75a77b69052e-46a4c00f1ddmr20923011cf.11.1735320527675; Fri, 27 Dec 2024 09:28:47 -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: <20241226235900.5a4e3ab79840e08482380976@linux-foundation.org> From: Suren Baghdasaryan Date: Fri, 27 Dec 2024 09:28:36 -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-Stat-Signature: rw6ookd1p44h8jiawfqb179q8c8j4nud X-Rspam-User: X-Rspamd-Queue-Id: 2C049180007 X-Rspamd-Server: rspam08 X-HE-Tag: 1735320522-10198 X-HE-Meta: U2FsdGVkX1/uguhgm6qsJ9rhQd4o/r7pmHjpRrh30rKeXI9pYx1MuayDk6Mw1JkwaslqJ8BJxVqjs3RO2dxbRzctpR200z2CxPM+4jhYGq1RL095O8r6HupGM/1xYZqhgTpdyvawVpksX3ENPkswlXpjyakREXyAcOrm6V4weo8oyM3Xiklt8W0jWtUno1OkES4cgDgDHvV9AonbwSBh7vdhfATqOLxo+Ie8jMPqlN86GzUMh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5kjtscw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.009790, 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 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 need = to swap > > > > > > allocation tags during migration. Skip it to avoid unnecessary = 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 much > > > > > difference the patches make would help people understand why we'r= e > > > > > 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 wh= y. > > > > Sorry, I should have used "overhead" instead of "regression". > > When one sets CONFIG_MEM_ALLOC_PROFILING=3Dy, the code gets instrumente= d > > 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%. > > 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 cores= : Overhead before fixes Overhead after fixes slab alloc page alloc slab alloc page a= lloc Big 6.21% 5.32% 3.31% 4.93% Medium 4.51% 5.05% 3.79% 4.39% Little 7.62% 1.82% 6.68% 1.02% > 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??