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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27107C433DF for ; Fri, 21 Aug 2020 18:09:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C1C4920720 for ; Fri, 21 Aug 2020 18:09:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1C4920720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 67A8E8D0069; Fri, 21 Aug 2020 14:09:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62AFA8D0002; Fri, 21 Aug 2020 14:09:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 541228D0069; Fri, 21 Aug 2020 14:09:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 3CA228D0002 for ; Fri, 21 Aug 2020 14:09:38 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E0A7912F7 for ; Fri, 21 Aug 2020 18:09:37 +0000 (UTC) X-FDA: 77175363594.27.dolls54_4301cad2703b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 7BA8D3D669 for ; Fri, 21 Aug 2020 18:09:37 +0000 (UTC) X-HE-Tag: dolls54_4301cad2703b X-Filterd-Recvd-Size: 1860 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Aug 2020 18:09:36 +0000 (UTC) Received: from gaia (unknown [95.146.230.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EC15120738; Fri, 21 Aug 2020 18:09:33 +0000 (UTC) Date: Fri, 21 Aug 2020 19:09:31 +0100 From: Catalin Marinas To: Davidlohr Bueso Cc: akpm@linux-foundation.org, oleg@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning Message-ID: <20200821180931.GF6823@gaia> References: <20200820203902.11308-1-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200820203902.11308-1-dave@stgolabs.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 7BA8D3D669 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote: > kmemleak_scan() currently relies on the big tasklist_lock > hammer to stabilize iterating through the tasklist. Instead, > this patch proposes simply using rcu along with the rcu-safe > for_each_process_thread flavor (without changing scan semantics), > which doesn't make use of next_thread/p->thread_group and thus > cannot race with exit. Furthermore, any races with fork() > and not seeing the new child should be benign as it's not > running yet and can also be detected by the next scan. > > Signed-off-by: Davidlohr Bueso As long as the kernel thread stack is still around (kmemleak does use try_get_task_stack()), I'm fine with the change: Acked-by: Catalin Marinas