From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90B702C11F1 for ; Tue, 16 Jun 2026 10:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781604437; cv=none; b=T6jzPAt2EbNr/yTUnmVrfhP6MUx1FHp1ZQNNQtTiutTUgqzSm6utorB4M2YKzEP/7XawxoTK0HMNe+BW3CC5mrMHHWVCaRDkplL+ibiHgPGzZx58BZJgClKwIdl8zL3eQoiemYmE+oCqJAEJunpBCJ4VDMUBrPXZLoj+A3U4+Y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781604437; c=relaxed/simple; bh=cnUxsHDpE8fDo8zpp5HNSES7d64ZxLydvRZIUzI0wsY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aLVyg1RYmONrYc5uoNBs1z4HKJmOomcICdDjinSwzM5pQU3N0M9/MqBrEBRKrIVliBsEEKAGDkTTfDHOrGCnyn1BKwuFq4Yctt3k1CFPpyKb5B4/xqUt5ABCyCp/TQyuh1kaUrRCCdnRuR8ZJSqHttqyiQKGIhO4s6E2rWAyrvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YP+5YKb9; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YP+5YKb9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781604435; 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: in-reply-to:in-reply-to:references:references; bh=JnNBSv3v4FocagLoCpPs9L+SB4WlGnzQON1M9zZhaH0=; b=YP+5YKb9VxX5uTfYyZzURW0SVcRmGOsh+bsk4GQWMHYzH7u97qW+NAFEQvrCEMX94Q0Ukb 0sxvqTM08VXeilGCHyzqf3TWGwRx1rldxGEnr8MguiaqeJEYG7pncGtzYyKmrcUHNbsAHW ISI6DPRNgIQ1kPZkk7igQEo6bFShCps= Received: from mx-prod-mc-03.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-116-gs6Nmro_P_qiSUu60nyS5w-1; Tue, 16 Jun 2026 06:07:12 -0400 X-MC-Unique: gs6Nmro_P_qiSUu60nyS5w-1 X-Mimecast-MFC-AGG-ID: gs6Nmro_P_qiSUu60nyS5w_1781604429 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 459131956055; Tue, 16 Jun 2026 10:07:09 +0000 (UTC) Received: from fedora (unknown [10.44.32.13]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id D4D37180034F; Tue, 16 Jun 2026 10:07:05 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 16 Jun 2026 12:07:08 +0200 (CEST) Date: Tue, 16 Jun 2026 12:07:04 +0200 From: Oleg Nesterov To: Breno Leitao Cc: Catalin Marinas , Andrew Morton , lance.yang@linux.dev, Davidlohr Bueso , Qian Cai , sj@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v3 3/3] mm/kmemleak: stop the per-cpu and struct page scans early too Message-ID: References: <20260615-kmemleak-stack-resched-v3-0-acecd7d7fd92@debian.org> <20260615-kmemleak-stack-resched-v3-3-acecd7d7fd92@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260615-kmemleak-stack-resched-v3-3-acecd7d7fd92@debian.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 06/15, Breno Leitao wrote: > > #ifdef CONFIG_SMP > /* per-cpu sections scanning */ > - for_each_possible_cpu(i) > - scan_large_block(__per_cpu_start + per_cpu_offset(i), > - __per_cpu_end + per_cpu_offset(i)); > + for_each_possible_cpu(i) { > + if (scan_large_block(__per_cpu_start + per_cpu_offset(i), > + __per_cpu_end + per_cpu_offset(i))) > + break; > + } > #endif The patch looks correct, but... if scan_large_block() returns true, then > @@ -1902,6 +1908,7 @@ static void kmemleak_scan(void) > unsigned long start_pfn = zone->zone_start_pfn; > unsigned long end_pfn = zone_end_pfn(zone); > unsigned long pfn; > + int stop = 0; > > for (pfn = start_pfn; pfn < end_pfn; pfn++) { > struct page *page = pfn_to_online_page(pfn); > @@ -1918,8 +1925,12 @@ static void kmemleak_scan(void) > /* only scan if page is in use */ > if (page_count(page) == 0) > continue; > - scan_block(page, page + 1, NULL); > + stop = scan_block(page, page + 1, NULL); it is pointless to enter this for_each_populated_zone() loop and call kmemleak_scan_task_stacks() after that? Not that I think this is bad, just a question... Oleg.