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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 232E3C28D13 for ; Fri, 19 Aug 2022 22:44:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89B886B0073; Fri, 19 Aug 2022 18:44:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84BA46B0074; Fri, 19 Aug 2022 18:44:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7127C8D0001; Fri, 19 Aug 2022 18:44:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5E8DD6B0073 for ; Fri, 19 Aug 2022 18:44:57 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 37872C1BF9 for ; Fri, 19 Aug 2022 22:44:57 +0000 (UTC) X-FDA: 79817823834.24.807E75D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id B79FD14008C for ; Fri, 19 Aug 2022 22:44:55 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 326B0B82975; Fri, 19 Aug 2022 22:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996E9C433C1; Fri, 19 Aug 2022 22:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1660949092; bh=s8PKxoj54nX65XSLJWvwOlsXTFX9oxeU7c5M0X//TrI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JHseprvTKx73mTepc3ANX5VSFgNTx8dSF5hSyR7qMWkHxt3k3vypwaBGHlaF4Ch0n fq1HKIH4bvo2I6lHUYEXuLDORyil74A4LhL/rQbxtrRUxOX9kZSJwiShKVrdH6YBY8 IiK/D3zRr+Yqts1mWu+fPpcStMeL8msluSQwfzAg= Date: Fri, 19 Aug 2022 15:44:51 -0700 From: Andrew Morton To: SeongJae Park Cc: gregkh@linuxfoundation.org, badari.pulavarty@intel.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] mm/damon/dbgfs: avoid duplicate context directory creation Message-Id: <20220819154451.9f424d9d563969d9cc6437f7@linux-foundation.org> In-Reply-To: <20220819211631.16658-1-sj@kernel.org> References: <20220819140809.1e3929fd8f50bfc32cae31d3@linux-foundation.org> <20220819211631.16658-1-sj@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660949095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qM0dLuzcOiDaQZQqok5r7N8dtz9R1ozqbhcd/X7iuPQ=; b=3KogLrY00P93+PZeLmuKZvLNyeUMm59C0FtGdrqFgk9A2lWr+BVv1zov46WnymRSTgPpxR 5NKro3DluYIJ4QoEfWdyV/M0Vyr+okUv8mNn2G4RdhgvXYcNRcENlWHx0MaIzDf5HZu0ho DuV4D/M9Ju+cVrWWDSEnfRwGOOMnBNg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=JHseprvT; dmarc=none; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660949095; a=rsa-sha256; cv=none; b=44nEcC0GXWtqjyCXWGU6ZYLUmZlARVIYBXnx+hahmkEIlu3SlPEBmN2q+Xz2dY2R6030gL TcEjiZbfri4AI2dsHhWGmX+soaFKHAQcRQ/oqOl8q2TdtcEZaQwUOVRdjVQ+katvPxz0yf P01hQU32dQ5MbPdBolaGciS9SZHYgn8= Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=JHseprvT; dmarc=none; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B79FD14008C X-Stat-Signature: rkx98u8o3nachrq481xc594i3z6btdbm X-Rspam-User: X-HE-Tag: 1660949095-995837 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 Fri, 19 Aug 2022 21:16:31 +0000 SeongJae Park wrote: > > It would be simpler (and less racy) to check the debugfs_create_dir() > > return value for IS_ERR()? > > I was merely following Greg's previous advice for ignoring the return value[1] > of the function, but I might misunderstanding his intention, so CC-ing Greg. > Greg, may I ask your opinion? > > [1] https://lore.kernel.org/linux-mm/YB1kZaD%2F7omxXztF@kroah.com/ Thing is, the correct functioning of the debugfs interfaces is utterly critical to damon. And that's apart from these memory leak and oops-we-killed-damon issues. So damon simply cannot ignore the state of its debugfs interfaces and keep going along - because if something goes wrong at the debugfs layer, damon is dead and useless and the machine needs a reboot. Perhaps this means that damon should not be using debugfs for its interfaces at all. Or it means that the debugfs interfaces are misdesigned. I go with the latter, which, alas, also affirms the former. >From a quick scan it appears that a significant minority (20%?) of drivers are checking the debugfs_create_dir() return value.