From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6622F233955 for ; Tue, 7 Jul 2026 15:31:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783438286; cv=none; b=B2ITVlDu4IkzM0/WWWkNBFkoEqFUZgrwWqC5SQ6cp0uO23S67yvj29pXLzkflpFK+JCGJjYmBT+xtNLN4YmHqndsPvOdeO7MJQgT4jip+GEFFLm9etndvIUI0K0wIYF3ShQi0Hj9cRXAu3uUYYgu34C+KFqcPD/kf7YZz1AnU/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783438286; c=relaxed/simple; bh=MR2WyGmFtqTX3py9tG8D+xTA5O9T8a5Czi4aDYUcQXY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MGxvqwaryLxnDC1w8NVBCpg+bh8IljknoJeLCAEFs4xaJtCariKhH63tXRwY03v1DU5rcGPEJYeYx4Dx4hnmTGdibJOQgyAqlrLwtrEAYec9gX/cGrZekAXTSBvyB5m7pekdMOL5XXltIoI7ZRX/VukG6jEKAzeXSeJTA1qQ7w4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=ZYMhCgWE; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="ZYMhCgWE" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 812751AED; Tue, 7 Jul 2026 08:31:18 -0700 (PDT) Received: from [192.168.178.6] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9C6973F905; Tue, 7 Jul 2026 08:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783438282; bh=MR2WyGmFtqTX3py9tG8D+xTA5O9T8a5Czi4aDYUcQXY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZYMhCgWEqyi5NfclPLHrdW/IY2crdoyijUtaNHtt7Gh84vtNSdknea3Hex1IoiMvs CA0ssx4AHoIjaIteS7kF/nWqrgT0TkWZKeX0qQVB80hh5mclFOsOaxSAEg2PT5i2Ag XspaZksOkYqpxhiiYVAw9wfgx5m/sfLbulZWzJt8= Message-ID: Date: Tue, 7 Jul 2026 17:31:16 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: kmemleak: sched_domain_shared leaked on asymmetric-capacity + SCHED_CACHE To: K Prateek Nayak , Breno Leitao Cc: Andrea Righi , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Christian Loehle , Phil Auld , Koba Ko , Felix Abecassis , Balbir Singh , Joel Fernandes , Shrikanth Hegde , linux-kernel@vger.kernel.org References: <20260509180955.1840064-1-arighi@nvidia.com> <20260509180955.1840064-3-arighi@nvidia.com> <73685ae1-6d90-4799-a1d7-08a1fcf24b8b@amd.com> <73697ae3-f826-4b0e-be05-446976223822@amd.com> <9476c607-92bd-4f98-b9a0-c9ca559c9d91@arm.com> From: Dietmar Eggemann Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 07.07.26 15:59, K Prateek Nayak wrote: > Hello Breno, > > On 7/7/2026 7:01 PM, Breno Leitao wrote: >>> I may have found what might be happening. Since the last SD_SHARE_LLC >>> and the first SD_ASYM_CPUCAPACITY_FULL overlap, >>> init_sched_domain_shared() for SD_SHARE_LLC might just be overwriting >>> the assignment from claim_asym_sched_domain_shared() and we are left >>> with a non-zero refcounted shared that evades claim_allocations() but >>> is not used anywhere either. >>> >>> Breno, could you try the below diff: >> >> Sure, I've tested it and I don't see the kmemleak report anymore, that >> solved the issue I've raised. >> >> Feel free to include the following if you are planning to send it to the >> list: >> >> Tested-by: Breno Leitao > > Thanks a ton! I'll send out an official patch shortly for Peter to pick > up once he is back from holidays after some more testing. Thank you > again for the report and testing. Much appreciated _/\_ Switched to an Arm64 board (Juno) with {L B B L L L} where this issue happens all the time since we rebuild the sched domain after CPU capacity setup and EAS bringup during boot. Simple CPU hotplug also shows it: With additional printks: base: root@juno:~# dmesg | grep -i "shared\|sd->shared\|_domain" [ 0.224492] build_sched_domains() this_cpu=0 [ 0.228817] build_sched_domains() cpu=0 sd=SMT [ 0.233284] claim_asym_sched_domain_shared() cpu=0 sd=SMT [ 0.238733] init_sched_domain_shared() this_cpu=0 cpu=0 flags=32 sd=MC sds=ffff00080003e800 ^^^^^^^^^^^^^^^^ [ 0.247129] build_sched_domains() cpu=0 sd=MC has SD_SHARE_LLC [ 0.252987] init_sched_domain_shared() this_cpu=0 cpu=1 flags=512 sd=MC sds=ffff00080003e7e0 ^^^^^^^^^^^^^^^^ [ 0.261460] build_sched_domains() cpu=1 sd=SMT ... [ 2.066061] free_sched_domain_shared() sds=ffff00080003e7e0 call ^^^^^^^^^^^^^^^^ kfree() root@juno:~# echo scan > /sys/kernel/debug/kmemleak [ 104.064760] kmemleak: unreferenced object 0xffff00080003e800 (size ^^^^^^^^^^^^^^^^^^ 32): [ 104.064778] kmemleak: comm "swapper/0", pid 1, jiffies 4294892335 [ 104.064786] kmemleak: hex dump (first 32 bytes): [ 104.064793] kmemleak: 06 00 00 00 06 00 00 00 00 00 00 00 20 00 00 00 ............ ... [ 104.064800] kmemleak: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ [ 104.064805] kmemleak: backtrace (crc 560f497a): root@juno:~# [ 104.064809] kmemleak: kmemleak_alloc+0x38/0x44 [ 104.064825] kmemleak: __kmalloc_cache_node_noprof+0x2bc/0x3a8 [ 104.064837] kmemleak: build_sched_domains+0x228/0x1540 [ 104.064846] kmemleak: sched_init_domains+0xd8/0x134 [ 104.064859] kmemleak: sched_init_smp+0x88/0x10c [ 104.064868] kmemleak: kernel_init_freeable+0x14c/0x2d4 [ 104.064877] kmemleak: kernel_init+0x2c/0x130 [ 104.064884] kmemleak: ret_from_fork+0x10/0x20 w/ patch: [ 0.224451] build_sched_domains() this_cpu=0 [ 0.228778] build_sched_domains() cpu=0 sd=SMT [ 0.233245] claim_asym_sched_domain_shared() cpu=0 sd=SMT [ 0.238694] init_sched_domain_shared() this_cpu=0 cpu=0 flags=32 sd=MC sds=ffff00080003e800 ^^^^^^^^^^^^^^^^ [ 0.247090] build_sched_domains() cpu=0 sd=MC has SD_SHARE_LLC [ 0.252948] init_sched_domain_shared() this_cpu=0 sd=MC sd->shared=ffff00080003e800 [ 0.252958] build_sched_domains() cpu=1 sd=SMT ... [ 2.090601] free_sched_domain_shared() sds=ffff00080003e800 call ^^^^^^^^^^^^^^^^ kfree() Tested-by: Dietmar Eggemann