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 245F2C369A4 for ; Thu, 10 Apr 2025 08:06:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BFE4280086; Thu, 10 Apr 2025 04:06:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DB2B28007D; Thu, 10 Apr 2025 04:06:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0535728008A; Thu, 10 Apr 2025 04:06:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CDC7428007D for ; Thu, 10 Apr 2025 04:06:36 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B68158047D for ; Thu, 10 Apr 2025 08:06:37 +0000 (UTC) X-FDA: 83317402434.25.E83D2B2 Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf02.hostedemail.com (Postfix) with ESMTP id 1C8448000B for ; Thu, 10 Apr 2025 08:06:34 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of rakie.kim@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=rakie.kim@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744272396; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zaKGyYXrdwYzHpxm2ZvpZ4Q48HVK/X2w7vqOapb+f1c=; b=YlWeqvNTqNnm8jeNBGxVCSrekQkoAVL0xmhZLDgZMvENgrdCOekTSwfhFqtf2N9uljX7Bq dxTxW2CWGOw0odu7xGrsvOSJFG+EcjLpoKWxczm33023mhSz5dUnZ7GmbpQ1BGF8dUDZJx 61oD6iCyE/XAMo5WZ0X6aUebdnmGibw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of rakie.kim@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=rakie.kim@sk.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744272396; a=rsa-sha256; cv=none; b=XFswsntBUJzPFH64WxdoIJDWOgbidRAiJnaBPs0dn+fYzX7j3EfQ4ONk9AfhcTuItLyJQk bIUJwv67XIQDz/86JX7OBXqnSgf7LKy4N/VTKn3jPIKEqXI4eXYRnU7LPDVHJfAx9Hs/TM fWpDEZC+2HlSrYKx79mA/hg/LZdmrWc= X-AuditID: a67dfc5b-669ff7000002311f-b1-67f77c09ae62 From: Rakie Kim To: akpm@linux-foundation.org Cc: gourry@gourry.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, joshua.hahnjy@gmail.com, ying.huang@linux.alibaba.com, david@redhat.com, Jonathan.Cameron@huawei.com, osalvador@suse.de, kernel_team@skhynix.com, honggyu.kim@sk.com, yunjeong.mun@sk.com, rakie.kim@sk.com, Dan Williams Subject: Re: [PATCH v7 2/3] mm/mempolicy: Prepare weighted interleave sysfs for memory hotplug Date: Thu, 10 Apr 2025 17:06:19 +0900 Message-ID: <20250410080629.564-1-rakie.kim@sk.com> X-Mailer: git-send-email 2.48.1.windows.1 In-Reply-To: <20250410075341.549-1-rakie.kim@sk.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsXC9ZZ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GX QhcjJ4eEgInEuW+r2boYOTjYBJQkju2NAQmLCMhKTP17nqWLkYuDWeATk8TBVz9YQRLCAnES +35vZAOxWQRUJfrXPQSL8woYS7xZsY0dYqamRMOle0wgNifI/D+3wWqEBHgkXm3YzwhRLyhx cuYTFhCbWUBeonnrbOYJjDyzkKRmIUktYGRaxSiSmVeWm5iZY6pXnJ1RmZdZoZecn7uJERj0 y2r/TNzB+OWy+yFGAQ5GJR5ej4xv6UKsiWXFlbmHGCU4mJVEeD0Nv6cL8aYkVlalFuXHF5Xm pBYfYpTmYFES5/UKT00QEkhPLEnNTk0tSC2CyTJxcEo1MM7abfvgpewkbpP0gEcnzPyY/fx3 ZUe1WF66en257+kGEZs36n4Xjxd8WbL2VEZHVhrXquK+0If1i+IZle85yy7Rud25N+vjAsGm ec+riiOOPNt/ssH41hSJm3I7RXWVbbfoLUnSnPKM71eUX9t3AfY72+8rTtLdN1vv2r4f6RxV 2yJPrGpMklZiKc5INNRiLipOBABEqBxVdgIAAA== X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 1C8448000B X-Stat-Signature: 89n5juwd5jntie4rs1x11fgrt8456nfw X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1744272394-884221 X-HE-Meta: U2FsdGVkX1+rwCsUNTOdl1yUB97ckYQe/aEdLx/k9Vbdi88ZeDapb5V4zO9Zc6ZqO+4d7Q37lnJbI9OgosGkBESfwPf1W7NRegvu70qAuDmFIqt7P1a66dz5WVFerU12fP1foOvjVqPRBP5GuQTYI/NL7SnWy0frNw8N/Zo3v5Qo7Q4oxIc5WA53HHcZLU6ts+Ykuv+ZxBQjp/clSKOA2GLfLLvd7ebS7/1qPW+dc26j/uh5334L+78p9vhozmIQRgOoF9UAfKsA8eBoC5+Lo9EfwmPibHN5zDu50mzCkw5niusaA7adR2ZZHqPEyI2Um0cMMc64bMhcya7iPfJZi5UhWpmU67JfvEuWE5tUC2WglUqyPFX1o5LkNjfC2s7MI0tUEmwt9BcReGfmdK592RNDnBd8dxmz0wlK6/s0yr8mCiiFuiHrhZsDtzervu4Bg+2OmXdKP7Y3HoMOzwEU7iv1m6RMVkDH9w/0HNnWMWV58x0OOdsSQevassWybj7A/kh0+ejExQhaZYsZd4hNmekOqwEfU4OjO0ium6d0tKFgJgbIiDsMZECSpYCzZzzMVmDf4tzclPMB8BM36XQOMep7amRHI8CEpe2rFHg3Eu6IcUJZ51Lg8WVGzcZKvT++zOvE1PrPbTSTb9ZrYazC5/wjPI6nA2ksaK//B0pMmar3d77nPmUKFy3bmnZTessnNLD3IBxk1SnKgBgwwLsBhi2EnRczm+idiVw7ZmEwS356uA9Ctf8AOQbtjIW6QeLnkolAiM62gAtw4Vb9YMCQAFsKteAq5+4et/E/9/wKqRbjiw+43aXFcRYmkcxFRIrZPJkY3DbCMic5DGBArLZKNAep6hEvHGr6Kn46d3rj1ZiXe+w95H81g7h1dFSVWN5+tpNJwltt1LiqOoqbzyIhSvX6FfTtrgKzUGG4UEIq0Xmb0seN8Jb4lcjeHYjAH3Mlq8JglahzAXbgie6+fhX g1qTLrOg 7DH8kxvs+FjkxEeO0dbwkrloes9BVJYSuAIL/jue1MemDcjC+5bLJX9a+3aEssPsVp8zW+R3ButVWwfRhxmcuMtkbMbhC25sfcDN3glFjQyOVVCHhlCxFjXrypoxGe4g4Nb1pAtXkRciTDTZnlEQ/g5RURQ== 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: List-Subscribe: List-Unsubscribe: On Thu, 10 Apr 2025 16:53:33 +0900 Rakie Kim wrote: > On Wed, 9 Apr 2025 11:51:36 -0700 Dan Williams wrote: > > Rakie Kim wrote: > > > > > > +static void sysfs_wi_node_delete(int nid) > > > > > > { > > > > > > - if (!node_attr) > > > > > > + if (!wi_group->nattrs[nid]) > > > > > > return; > > > > > > - sysfs_remove_file(parent, &node_attr->kobj_attr.attr); > > > > > > - kfree(node_attr->kobj_attr.attr.name); > > > > > > - kfree(node_attr); > > > > > > + > > > > > > + sysfs_remove_file(&wi_group->wi_kobj, > > > > > > + &wi_group->nattrs[nid]->kobj_attr.attr); > > > > > > > > > > This still looks broken to me, but I think this is more a problem that > > > > > was present in the original code. > > > > > > > > > > At this point @wi_group's reference count is zero because > > > > > sysfs_wi_release() has been called. However, it can only be zero if it has > > > > > properly transitioned through kobject_del() and final kobject_put(). It > > > > > follows that kobject_del() arranges for kobj->sd to be NULL. That means > > > > > that this *should* be hitting the WARN() in kernfs_remove_by_name_ns() > > > > > for the !parent case. > > > > > > > > > > So, either you are not triggering that path, or testing that path, but > > > > > sys_remove_file() of the child attributes should be happening *before* > > > > > sysfs_wi_release(). > > > > > > > > > > Did I miss something? > > > > > > > > I think the missing change is that sysfs_wi_node_add() failures need to > > > > be done with a sysfs_wi_node_delete() of the added attrs *before* the > > > > kobject_del() of @wi_group. > > > > > > Hi Dan Williams > > > > > > Thank you very much for identifying this potential issue in the code. > > > > > > As you pointed out, this seems to be a problem that was already present in > > > the original implementation, and I agree that it needs to be addressed. > > > > > > However, since this issue existed prior to the changes in this patch > > > series, I believe it would be more appropriate to fix it in a separate > > > follow-up patch rather than include it here. > > > > I tend to disagree. The whole motivation of this series is to get the > > kobject lifetime handling correct in order to add the new dynamic > > capability. The claimed correctness fixups are incomplete. There is time > > to respin this (we are only at -rc1) and get it right before landing the > > new dynamic capability. > > > > One of the outcomes of the "MM Process" topic at LSF/MM was that Andrew > > wanted more feedback on when patches are not quite ready for prime-time > > and I think this is an example of a patch set that deserves another spin > > to meet the stated goals. > > > > > I will start preparing a new patch to address this problem, and I would > > > greatly appreciate it if you could review it once it's ready. > > > > Will definitely review it. I will leave to Andrew if he wants an > > incremental fixup on top of this series, or rebase on top of a fully > > fixed baseline. My preference is finish fixing all the old kobject() > > issues and then rebase the new dynamic work on top. Either way, do not > > be afraid to ask Andrew to replace a series in -mm, that's a sign of the > > process working as expected. > > Thank you very much for your advice, and I completely agree with your > recommendation. I will immediately ask Andrew to remove this patch series > from -mm. Then, I will prepare a new version, v8, which properly addresses > the kobject-related issues you pointed out. > > Once again, I sincerely appreciate your thoughtful and detailed feedback. > > Rakie > To Andrew I sincerely apologize for the inconvenience. It appears that this commit still requires additional corrections. I would appreciate it if you could drop the changes you merged into -mm, mm-new branch yesterday. <1> The patch titled Subject: mm/mempolicy: fix memory leaks in weighted interleave sysfs has been added to the -mm mm-new branch. Its filename is mm-mempolicy-fix-memory-leaks-in-weighted-interleave-sysfs.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mempolicy-fix-memory-leaks-in-weighted-interleave-sysfs.patch <2> The patch titled Subject: mm/mempolicy: prepare weighted interleave sysfs for memory hotplug has been added to the -mm mm-new branch. Its filename is mm-mempolicy-prepare-weighted-interleave-sysfs-for-memory-hotplug.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mempolicy-prepare-weighted-interleave-sysfs-for-memory-hotplug.patch <3> The patch titled Subject: mm/mempolicy: support memory hotplug in weighted interleave has been added to the -mm mm-new branch. Its filename is mm-mempolicy-support-memory-hotplug-in-weighted-interleave.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mempolicy-support-memory-hotplug-in-weighted-interleave.patch Rakie