From patchwork Thu Sep 19 19:13:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 13807960 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 730E7CF3963 for ; Thu, 19 Sep 2024 19:14:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF0756B0085; Thu, 19 Sep 2024 15:14:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA0236B0089; Thu, 19 Sep 2024 15:14:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 967B76B008A; Thu, 19 Sep 2024 15:14:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 77EED6B0085 for ; Thu, 19 Sep 2024 15:14:16 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E57BBA0FA7 for ; Thu, 19 Sep 2024 19:14:15 +0000 (UTC) X-FDA: 82582438470.24.825F97A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 4A0B1A0012 for ; Thu, 19 Sep 2024 19:14:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PQf04Hh+; spf=pass (imf15.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726773196; a=rsa-sha256; cv=none; b=8AcN8OpbetHxVCU38F4qCKBX05nZ6hCnmDCZBWttvDl+LerWRvt+9Fa2h6n84/I6RD+Q09 Aff6Qr+nPtSz0hvOSYVUFlRatD+eooWan+1uopnmIer0M7t5zTsVA2vFLOGEe6JI7u0KHP vNX8qwZkfi+EMNTxfdqsCMizVmJqIZQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PQf04Hh+; spf=pass (imf15.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726773196; 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: references:dkim-signature; bh=+io0bQ7YY0xQVBt4I/DgX0X8J9QiI1A9WEgxXR3OG6I=; b=PxGFSgA4pmxByy4tq6tmNJ8VeTzMYowgoTGee9mSz06BoMQpl784oxF10z2wa7eChj8MYy zOPPAnubN2Hps7KmuEWrYva/CTglxfIcXe2gLIoafY+Om+XgP/SlJOmZRnmVuJ4TPbtug0 +im793RDp/otTm/ovk+gQyG7Hc2wugQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726773253; h=from:from: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; bh=+io0bQ7YY0xQVBt4I/DgX0X8J9QiI1A9WEgxXR3OG6I=; b=PQf04Hh+K88tkcf1XYSl8StH5nJOVdS2JLhvCP6Ws/m+hLRGUOSl2pGrvcpyZZyPnoGVdt vuNBCAl90Ih/QKrKDBIj0BzbX2rseXagqjiM9fIfHGyDT2hWWpMCOmNpeaF5P4p6O6DeD5 odw0+XfEwHAfogeg9jFZ3Rz/p88a1tY= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-W5ex_4jKN3SFjKo0sztS2g-1; Thu, 19 Sep 2024 15:14:10 -0400 X-MC-Unique: W5ex_4jKN3SFjKo0sztS2g-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DCE3E1935D3E; Thu, 19 Sep 2024 19:14:06 +0000 (UTC) Received: from llong.com (unknown [10.45.224.31]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F18BE19560A3; Thu, 19 Sep 2024 19:14:03 +0000 (UTC) From: Waiman Long To: Andrew Morton , Huang Ying , Alistair Popple , Dave Jiang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH] memory tier: Remove unused default_dram_perf_ref_source Date: Thu, 19 Sep 2024 15:13:57 -0400 Message-ID: <20240919191357.49976-1-longman@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Signature: 4dr5iyiydj3omz13am1w5gkqxkruuen7 X-Rspamd-Queue-Id: 4A0B1A0012 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1726773254-877574 X-HE-Meta: U2FsdGVkX1/NSpNP3/H61z4aKtDVD1QTDOk93FXE+mMn+VoTTkkn59vhcpZTnWS5/xff98N/fbJn+2jkqDVEa20yGRghS/OvOlLE9Y743bpG5jF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XA91pK5zEVyLlzbz/G4FvX3FkADhlMVbWOWTiHmruKmggysibzNsQfC4DORGa+SWetJcPceULCfAcUjXDhVI3gBzfUJ/TFczTTVXHhwsFJDLsyVk30eKb2o9VEApw06P8yleuGAt/wgTMQ8Frbk21QKfgUFI2bAJCLKlY3X+Nt44b2si+Z2mmhmqYopVkWM37jU29vS60MIVw7h0qRD4kWZYxEXSvPrpJMOQgC/ZDjDbNacqJzN 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: Commit 3718c02dbd4c ("acpi, hmat: calculate abstract distance with HMAT") added a default_dram_perf_ref_source variable that was initialized but never used. This causes kmemleak to report the following memory leak: unreferenced object 0xff11000225a47b60 (size 16):   comm "swapper/0", pid 1, jiffies 4294761654   hex dump (first 16 bytes):     41 43 50 49 20 48 4d 41 54 00 c1 4b 7d b7 75 7c  ACPI HMAT..K}.u|   backtrace (crc e6d0e7b2):     [] __kmalloc_node_track_caller_noprof+0x36b/0x440     [] kstrdup+0x36/0x60     [] mt_set_default_dram_perf+0x23a/0x2c0     [] hmat_init+0x2b3/0x660     [] do_one_initcall+0x11c/0x5c0     [] do_initcalls+0x1b4/0x1f0     [] kernel_init_freeable+0x4ae/0x520     [] kernel_init+0x1c/0x150     [] ret_from_fork+0x31/0x70     [] ret_from_fork_asm+0x1a/0x30 Fix this memory leak by removing default_dram_perf_ref_source. Fixes: 3718c02dbd4c ("acpi, hmat: calculate abstract distance with HMAT") Signed-off-by: Waiman Long Signed-off-by: "Huang, Ying" Reported-by: Waiman Long Acked-by: Waiman Long --- mm/memory-tiers.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index 4775b3a3dabe..baa5f20e3b78 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -119,7 +119,6 @@ static DEFINE_MUTEX(default_dram_perf_lock); static bool default_dram_perf_error; static struct access_coordinate default_dram_perf; static int default_dram_perf_ref_nid = NUMA_NO_NODE; -static const char *default_dram_perf_ref_source; static inline struct memory_tier *to_memory_tier(struct device *device) { @@ -728,7 +727,6 @@ int mt_set_default_dram_perf(int nid, struct access_coordinate *perf, if (default_dram_perf_ref_nid == NUMA_NO_NODE) { default_dram_perf = *perf; default_dram_perf_ref_nid = nid; - default_dram_perf_ref_source = kstrdup(source, GFP_KERNEL); return 0; }