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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 04707C433DB for ; Sat, 20 Mar 2021 07:52:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6D2D261999 for ; Sat, 20 Mar 2021 07:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D2D261999 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A6B5B6B0087; Sat, 20 Mar 2021 03:52:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F3696B0089; Sat, 20 Mar 2021 03:52:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81F336B008A; Sat, 20 Mar 2021 03:52:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id 636CF6B0087 for ; Sat, 20 Mar 2021 03:52:56 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1B5AFAF79 for ; Sat, 20 Mar 2021 07:52:56 +0000 (UTC) X-FDA: 77939486352.37.7B57352 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf16.hostedemail.com (Postfix) with ESMTP id 80C4F80192C0 for ; Sat, 20 Mar 2021 07:52:55 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D3C361933; Sat, 20 Mar 2021 07:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616226772; bh=AascX6NXhN/yFeD+IfuRay7JVAU7QFt1V1bttvBXuas=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ieGzFfy35KxYv+fBOV7DC4aJ9w2UdmKWYh+KQ2qkDWA2ABLbgr9Woxq6QamSzVhL0 XrO6oudmkZC1cwNJhMul41q+YH5LUYR3oh4Tb/ishEBtiZWveHHdQuoI+x107zdmQJ WIslfOgerBAVjrSS6X7AsvMwQOidOdWjn7W19BeI= Date: Sat, 20 Mar 2021 08:52:49 +0100 From: Greg Kroah-Hartman To: Dmitry Osipenko Cc: Minchan Kim , Andrew Morton , linux-mm , LKML , joaodias@google.com, willy@infradead.org, david@redhat.com, surenb@google.com, John Hubbard , Nicolas Chauvet , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH v4] mm: cma: support sysfs Message-ID: References: <78883205-e6da-5bc4-dcec-b6eb921567b1@gmail.com> <72db59eb-75dc-d1ed-7a83-17052e8f22a8@gmail.com> <071c6681-f492-2c94-5686-30c30778f39d@gmail.com> <007c0317-8819-a6b8-fdff-c0b5899c4f51@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Stat-Signature: 5fy89zfgyf6egurdcqd81stu6acenkki X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 80C4F80192C0 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616226775-508293 Content-Transfer-Encoding: quoted-printable 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, Mar 19, 2021 at 10:24:03PM +0300, Dmitry Osipenko wrote: > 19.03.2021 22:03, Minchan Kim =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On Fri, Mar 19, 2021 at 09:48:11PM +0300, Dmitry Osipenko wrote: > >> 19.03.2021 21:21, Minchan Kim =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >>> On Fri, Mar 19, 2021 at 08:56:06PM +0300, Dmitry Osipenko wrote: > >>>> 19.03.2021 19:30, Minchan Kim =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >>>>> +static void cma_kobj_release(struct kobject *kobj) > >>>>> +{ > >>>>> + struct cma_kobject *cma_kobj =3D container_of(kobj, struct cma_= kobject, kobj); > >>>>> + > >>>>> + kfree(cma_kobj); > >>>>> +} > >>>> > >>>> Oh, wait.. I think this kfree wrong since cma_kobj belongs to the = array. > >>> > >>> Oh, good spot. Let me use kzalloc. > >>> > >> > >> Thinking a bit more about this.. it looks like actually it should be > >> better to get back to the older variant of cma_stat, but allocate at= the > >> time of CMA initialization, rather than at the time of sysfs > >> initialization. Then the cma_stat will be decoupled from the cma str= uct > >=20 > > IIRC, the problem was slab was not initiaized at CMA init point. > > That's why I liked your suggestion. >=20 > Alright, if CMA init time is a problem, then the recent variant should > be okay. >=20 > >> and cma_stat will be a self-contained object. > >=20 > > Yeah, self-contained is better but it's already weird to > > have differnt lifetime for one object since CMA object > > never die, technically. > >=20 >=20 > Indeed. >=20 > I found the Greg's original argument and not sure that it's really > worthwhile to worry about the copycats since this is not a driver's cod= e.. >=20 > Maybe we could just add a clarifying comment for the kobj, telling why > it's okay for CMA. Greg, doesn't it sound like a good compromise to you= ? Please no.