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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 AEAA3C4727D for ; Tue, 22 Sep 2020 09:03:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1992B2396D for ; Tue, 22 Sep 2020 09:03:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1992B2396D 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 47FCE90003F; Tue, 22 Sep 2020 05:03:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43085900036; Tue, 22 Sep 2020 05:03:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36E2190003F; Tue, 22 Sep 2020 05:03:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 239B3900036 for ; Tue, 22 Sep 2020 05:03:54 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E687181D1 for ; Tue, 22 Sep 2020 09:03:53 +0000 (UTC) X-FDA: 77290109946.02.queen74_1013cbb2714c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id B7299100DCA73 for ; Tue, 22 Sep 2020 09:03:53 +0000 (UTC) X-HE-Tag: queen74_1013cbb2714c X-Filterd-Recvd-Size: 2255 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 09:03:53 +0000 (UTC) Received: from gaia (unknown [31.124.44.166]) (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 0B5AC20715; Tue, 22 Sep 2020 09:03:50 +0000 (UTC) Date: Tue, 22 Sep 2020 10:03:48 +0100 From: Catalin Marinas To: Chen Jun Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rui.xiang@huawei.com, weiyongjun1@huawei.com Subject: Re: [PATCH -next 2/5] mm/kmemleak: skip update_checksum for OBJECT_NO_SCAN objects Message-ID: <20200922090346.GA15643@gaia> References: <20200921020007.35803-1-chenjun102@huawei.com> <20200921020007.35803-3-chenjun102@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921020007.35803-3-chenjun102@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Mon, Sep 21, 2020 at 02:00:04AM +0000, Chen Jun wrote: > From: Wei Yongjun > > Objects marked with OBJECT_NO_SCAN are never scanned. > So there is no need to update checksum for them. > > Signed-off-by: Wei Yongjun > Signed-off-by: Chen Jun > --- > mm/kmemleak.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > index b3f603fd9fc3..c09c6b59eda6 100644 > --- a/mm/kmemleak.c > +++ b/mm/kmemleak.c > @@ -1166,6 +1166,10 @@ static bool update_checksum(struct kmemleak_object *object) > { > u32 old_csum = object->checksum; > > + /* always return false for not scan object */ > + if (object->flags & OBJECT_NO_SCAN) > + return false; The reason for OBJECT_NO_SCAN is to avoid introducing more false negatives. The point of the checksum is to reduce the false positives - i.e. an object that is being modified between scans won't be considered a (transient) leak even if kmemleak couldn't find a reference pointer to it. So please drop this patch. -- Catalin