Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2104942pxf; Sat, 20 Mar 2021 04:45:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeWMj5yXqPo76DAmwLUHFcJFn86kWjrdXWT+sAuZC0bCmLDhzZsI2FlFepKSK37/FvxCQG X-Received: by 2002:a17:906:3ac3:: with SMTP id z3mr9560312ejd.106.1616240728836; Sat, 20 Mar 2021 04:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616240728; cv=none; d=google.com; s=arc-20160816; b=p9lqESgMjjW54E3DPw5LGWpm/cos96Zh8Wb3YS34pQ6829YSXOULS+rAHgEe8uCX6A owQVTTq+Y8vZnay2WwqqSGswdsEmZRqAwNousj69v86XDoKpR+cSK6y4vVtz1fZ04BOg cX6ZHysGFXpzZ2ONs6xJ3zk+XhvlslUXNMiyzDYV3ZbZtdcCTS+NBdXt7E8iTW6AdIju miLfPOUwJDaDJjCjGvVFDSX1BNytykXdJyPpozzbs8rG7ufAJLIU9wpd+7+6jBvGlBaJ 0cMSjF5BSaNDG5TvY8GcLHUvI3ZZKSGUT/eG3MqshzeygxGpXOMPJUWSHSlj/G9fsFkr 7bJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ot/P71BZjH2S2enupW+KipXiaSiaexyS4K7agxqXWHU=; b=FDep1uYUiAGKnZZosrL6XXJHzY06C+GQ2QYyavkoC5G+vpnzhUOpFjQwqp0HXpLXDf VDd6bQI+YFuGDim/HPrRJ/wHDkq1eUBKWnzBhYuMTNdIiSDjOw5ossJSoNdsisCt58Ta DsCYXTKLfjqn0RkmqRs6F+el3o7wHb9FQIn/iRC7/U15oxTWQL1zUGpyfpF6G7RuzCGO OKwazNSWKA8kV+HyfPU12z1Dd1PFlWfuGbQKZjuOu1nNhCbD3cJHDuAUDafXyDy1PCyR wGeDa8ZdD0z0ixqubZwY1wZetlcjMDcmXnlD6mQasDQw253+88YSty3CNrd/7qTLN27O 6FGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieGzFfy3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kd10si6312290ejc.41.2021.03.20.04.45.06; Sat, 20 Mar 2021 04:45:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieGzFfy3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbhCTLnq (ORCPT + 99 others); Sat, 20 Mar 2021 07:43:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:60396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhCTLnn (ORCPT ); Sat, 20 Mar 2021 07:43:43 -0400 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 Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 19, 2021 at 10:24:03PM +0300, Dmitry Osipenko wrote: > 19.03.2021 22:03, Minchan Kim пишет: > > On Fri, Mar 19, 2021 at 09:48:11PM +0300, Dmitry Osipenko wrote: > >> 19.03.2021 21:21, Minchan Kim пишет: > >>> On Fri, Mar 19, 2021 at 08:56:06PM +0300, Dmitry Osipenko wrote: > >>>> 19.03.2021 19:30, Minchan Kim пишет: > >>>>> +static void cma_kobj_release(struct kobject *kobj) > >>>>> +{ > >>>>> + struct cma_kobject *cma_kobj = 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 struct > > > > IIRC, the problem was slab was not initiaized at CMA init point. > > That's why I liked your suggestion. > > Alright, if CMA init time is a problem, then the recent variant should > be okay. > > >> and cma_stat will be a self-contained object. > > > > Yeah, self-contained is better but it's already weird to > > have differnt lifetime for one object since CMA object > > never die, technically. > > > > Indeed. > > 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 code.. > > 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.