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 A9255E7718B for ; Fri, 27 Dec 2024 07:59:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21FC06B0083; Fri, 27 Dec 2024 02:59:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CF2F6B0085; Fri, 27 Dec 2024 02:59:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BE036B0088; Fri, 27 Dec 2024 02:59:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E35BF6B0083 for ; Fri, 27 Dec 2024 02:59:04 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9A0EAA1B80 for ; Fri, 27 Dec 2024 07:59:04 +0000 (UTC) X-FDA: 82939987830.14.981BE7A Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf08.hostedemail.com (Postfix) with ESMTP id 756CD160006 for ; Fri, 27 Dec 2024 07:58:34 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=XQUscpec; dmarc=none; spf=pass (imf08.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735286323; 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=Dycnf99u/HJeRTXY6z8N0yXb4630zvbZmk00jeP5X9M=; b=GTne6OmionJG9YvFVtqLmrnHtSEN0hgol+sBTALu4x8TotDsZv8MNkcCO+BfFLEADbUSFV vStTr/M0wQusKS1imGlt2JQpaOS75QQQaoMRRuxva9rnRRwrizu6xiK3O/Cnqm5v5AdfD7 Sx6JSE4RNnRRlQ4GRYIih89+jGeixjU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735286323; a=rsa-sha256; cv=none; b=TiVgQiUulJiofJd+jCbo1sAQhK458RxJSgmOMFqU5pQo3n0vjhT9ocKOPQX4HSGdRBIU9S N8PTuaIGvhMGF8crUMaSNZUfl/5Nh0dHqDoX57B1goL/h78KMRF1/CYqbubnA/uogYYuER LiCnx8oUJu3PAINJLkdXsPMT9V2Qtmg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=XQUscpec; dmarc=none; spf=pass (imf08.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 616C7A411C5; Fri, 27 Dec 2024 07:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 885AFC4CED0; Fri, 27 Dec 2024 07:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1735286341; bh=jm1RYTQY7LJ4qbIfPO3KSN9Mx6BcILm8uE3LFOmCLKI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XQUscpecphgYEMXHTscPORqu4AK0HvYZjoKM9AAqYqUj/Ob4GnAnN7+iZq70E7NcL GWXKByH3W0tmCKd7tUDZNTqTtuba9WIi0FrGlbcHa5uSgM33igqED0laJz+XoZ4DzW 5nykr7zBfUpVNC1EYfIg1Qo0BjqlLRgLTJN8xkZ8= Date: Thu, 26 Dec 2024 23:59:00 -0800 From: Andrew Morton To: Suren Baghdasaryan 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 Subject: Re: [PATCH 2/2] alloc_tag: skip pgalloc_tag_swap if profiling is disabled Message-Id: <20241226235900.5a4e3ab79840e08482380976@linux-foundation.org> In-Reply-To: References: <20241226211639.1357704-1-surenb@google.com> <20241226211639.1357704-2-surenb@google.com> <20241226150127.73d1b2a08cf31dac1a900c1e@linux-foundation.org> <20241226162315.cbf088cb28fe897bfe1b075b@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Stat-Signature: t481uynkhxfx7bquaonjj4z1md38195x X-Rspamd-Queue-Id: 756CD160006 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1735286314-497127 X-HE-Meta: U2FsdGVkX1/LbPPSZaLQZL4AR39r+orCHpEJLjGSqdRXIVI+abzdGVcizXC41PEyfu5L8xksQwba61ARAES7xycLBP7xso5uDtBtPY7M0OQAeUssAMbU2t2fSW7vF6IAiVFLZeEW0+c4GlCZ1lHDph2K0UVEY1V6xlOtf7SRaPgheAaDC6XuiMUjYJg1NoTy54TihySUtsLqKMzX/EbbLk/kaB79p4eR85nJiG/Ioo26PJ8vJm21y3MZnPc8OOOBMyQDSwxhtbqnAwZQOEPBTYp+xgemdD8YTfpJNKnd7+0OKTUXircIOn4uIcbPDmvpgVJkzKJP43HxMpXG+z+QR3iNmCaWcrkBi8UrWPZT8gJbuGcNyHQR0G0O9g55q1TO3XK2RQOTiYKWZl8vGOLHxM0Y3Idr6AC1kdf4clkRnN7vvQBkrFy4oPsBKulqh0T87X8uki6wfS7656pwyk1XKLTcgT0hAIjbQ0nnSpDPDjEDugeuTdBO1cw5gzZZ//Cc0jR0Vtn0eWaQJeF7w/eks7Qv8PyeJMpnzMAp+AqB2We+8/A7F9ITqjy852jnCGTP/FK4GRLXtetDId8i/juMqkfWwUij2soNT0haDdrEpLmvDmuwBalYphvDSBo4JzDO8qg8FQHJeZBN9DcjYA7+MThfAoufkRY+eAuzFd1gxHrwPBkl/BR3iGGhIHsMKQ8tSeYgoRIjSwC/GrtmU2C/SHlN6TAFmRABp5LuRpJIE4iM67RCG80bmUviBO1P0JXtJ2L6YmV7/Xe9rnJK5tKplKwB601xnTo+SmdeBuDorDfKdKNQ4VU/2+HuALZgSydO5XgyBJQLL6UP/qYmvEYU3FNlCf0QWC5hRCUoTRu3Fm+HEQ+Zej1JnKhNuAxtTYjWJZie2/4Tai3+vKtYSCu0IXM8W54hJra6HxH3TObFL0WGobNB/QaGGu2NIW7y1/arWqlAQsZDnZb5TsQEx0X WxKAWRsn WO2J5ys+WwHE3uLIulZdTX7dtG9XLgOl/Z2CdwxVEDJoBt7EXCK84eA3ho6He085OfA8G0jR/VEriJc3fgJ7kShEp7A67jTvni/BIAqkGgCj83EPEyppp4t58mWRRoP1HxCGw1/3yj9ewK5ulXrpEBk7R4jqkGh91AdnNQMZQ1r4eiMgFxnTqeE/ceDsrJaLOT5DR9+pIdid4XN0xiuuDUnjYcmlkI9eyl581wf52qG346imss4Pz2LvKK0neVnUBYMu3xsscrU+pBXQI7FugB9ziiyFLlGzArOYQpu5H0bzs74X4HFsHGAJtnYIYjxpbpntFNbpQpvZUWVxUU65e2D2+0y28lf8ESTlokoKxqwB3xm1rHomha3AqxQyhNAmGI0aH1oSCZJWFAjkMbCy5fl/EnzbOf3jFU/azAceBlZtXcq8= 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: On Thu, 26 Dec 2024 16:56:00 -0800 Suren Baghdasaryan wrote: > On Thu, Dec 26, 2024 at 4:23 PM Andrew Morton wrote: > > > > On Thu, 26 Dec 2024 15:07:39 -0800 Suren Baghdasaryan wrote: > > > > > On Thu, Dec 26, 2024 at 3:01 PM 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'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=y, 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%. Well, a 50% reduction in a 0.0000000001% overhead ain't much. 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??