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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4210C433EF for ; Fri, 26 Nov 2021 16:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378317AbhKZQNe (ORCPT ); Fri, 26 Nov 2021 11:13:34 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59152 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231590AbhKZQLc (ORCPT ); Fri, 26 Nov 2021 11:11:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B603622BA for ; Fri, 26 Nov 2021 16:08:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83405C93056; Fri, 26 Nov 2021 16:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637942898; bh=ldZ57wYv4qTm/b/OZ2H3dnpsDTz+mhkCO8xGuQiSWOY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZVFabhiBa2Zk6NVx8vxlRw0Qc1wp8ozgDLh6R6neq7xcCMCQJ/ap/u/TcA/EE3E6u AH0AhlsRBgkU/SkxP4xEnoDj0zfjY7bKlZa4H2Qnwa96vyOBSK3KE3i0w1BVMtsPDQ +dXa+WJmVxiOVEWBjy16iAFLzxF+tDrfLS/Vmm70= Date: Fri, 26 Nov 2021 17:08:16 +0100 From: Greg Kroah-Hartman To: Ming Lei Cc: Petr Mladek , linux-kernel@vger.kernel.org, Luis Chamberlain , Joe Lawrence Subject: Re: [PATCH 1/2] kobject: don't delay to cleanup module kobject Message-ID: References: <20211105063710.4092936-1-ming.lei@redhat.com> <20211105063710.4092936-2-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105063710.4092936-2-ming.lei@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 05, 2021 at 02:37:09PM +0800, Ming Lei wrote: > CONFIG_DEBUG_KOBJECT_RELEASE is used for debugging kobject release/cleanup > issue. The module kobject is released after module_exit() returns. If > this kobject is delayed too much, and may cause other kobject's > cleaned up a bit earlier before freeing module, then real issue is > hidden. > > So don't delay module kobject's cleanup, meantime module kobject is > always cleaned up synchronously, and we needn't module kobject's > cleanup. > > Signed-off-by: Ming Lei > --- > lib/kobject.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/lib/kobject.c b/lib/kobject.c > index ea53b30cf483..4c0dbe11be3d 100644 > --- a/lib/kobject.c > +++ b/lib/kobject.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > /** > * kobject_namespace() - Return @kobj's namespace tag. > @@ -727,6 +728,10 @@ static void kobject_release(struct kref *kref) > struct kobject *kobj = container_of(kref, struct kobject, kref); > #ifdef CONFIG_DEBUG_KOBJECT_RELEASE > unsigned long delay = HZ + HZ * (get_random_int() & 0x3); > + > + if (kobj->ktype == &module_ktype) > + delay = 0; No, there should not be anything "special" about module kobjects to get this kind of treatment. They should work like any other kobject and clean up properly when needed. thanks, greg k-h