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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 5126FC433DB for ; Fri, 19 Mar 2021 19:04:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02B1861941 for ; Fri, 19 Mar 2021 19:04:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02B1861941 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7859F6B006E; Fri, 19 Mar 2021 15:04:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 735B26B0070; Fri, 19 Mar 2021 15:04:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AEF66B0071; Fri, 19 Mar 2021 15:04:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 3EFFE6B006E for ; Fri, 19 Mar 2021 15:04:08 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F17841E1A for ; Fri, 19 Mar 2021 19:04:07 +0000 (UTC) X-FDA: 77937548934.19.8E3C0D3 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf26.hostedemail.com (Postfix) with ESMTP id 5033C4000F75 for ; Fri, 19 Mar 2021 19:03:50 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id e33so4319850pgm.13 for ; Fri, 19 Mar 2021 12:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=RY4pLK9k4mNEtiGyVCqmRISme5ShUYMejZygdlUQWa0=; b=ZxCHUCqmUqEddVD9ZpJmJ3k+Y48geenVlK3+gyb3VWDF05fast3iI4YNuhnPV6x3Kx P0n1g+Y7C7pXaq/ORU3uNsFdFXmI46MMkjUC8FiGe7AOf8vvthxVbQyOjBJYA2yfC45T dmxYg9+isipKlAfadltnEc6iCPntiENMSrEDYSi5bHYhD+1iISBZu36Cf7wsmqy/uowj M8rTinQiqU/1gHmGoCBrvtZBSrGN7zConGbJl98wCTVZuSSIMew8O7/rR4lUEaz5h03Z 2Yj+O2Ucv4xEdTsYWC4PqNRtPz/BwaKAEWlUW521jQ0h/7nZqnEjP/by9CVmlz5WAzMD Vx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=RY4pLK9k4mNEtiGyVCqmRISme5ShUYMejZygdlUQWa0=; b=Vn3UlYe0rfijAwpkueZvo03s0Qgx8syDXwamLlcw4IjO8ly4mi5b9VLsXEa7/9aqK8 1Dvfr0IujQTRgeGJo7VzsC2WFxsbxLUh0hFMDAmxXymBargqPQIDt/dXjCghex7QbFWj FqDadnG+Id/wHXeR00zHeUhv4IuqctZR5U3AWAlSJxWOl2CyAhxAXc3O//9Lw1PAXqCo i6s/eWpq61C6tOf7DpN1C9cCrm47rXi3p+8OK0HQuZmYQmDDUMWTULkBmLDj5ny+wwKn /Wq0C0/Zjr6jo3SfZ910L9h32J3vGjNJ84FNeVmnAsmD6PGWXJFhgGotSOXvY83Bc2EQ Yv/w== X-Gm-Message-State: AOAM5330N5XUm9wNcOxWUWx4ZqV5haAv3Y9B3dvIRnUW2YRegoL3B//1 jqwKXAA97r801RJwIog+Tm8= X-Google-Smtp-Source: ABdhPJzaExzsCk+tw5IbjmUjqP+Z2royJZuLdH5tCHDU31/INu+Y8kzNUB+6UXtptyhu+UNfdzJ74g== X-Received: by 2002:aa7:9246:0:b029:1ed:cfa4:f1a8 with SMTP id 6-20020aa792460000b02901edcfa4f1a8mr10458327pfp.73.1616180629766; Fri, 19 Mar 2021 12:03:49 -0700 (PDT) Received: from google.com ([2620:15c:211:201:2033:9813:e1ed:7060]) by smtp.gmail.com with ESMTPSA id p11sm5965392pjo.48.2021.03.19.12.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 12:03:48 -0700 (PDT) Date: Fri, 19 Mar 2021 12:03:46 -0700 From: Minchan Kim To: Dmitry Osipenko Cc: Greg Kroah-Hartman , 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: <33ec18ef-8652-643a-1a53-ff7c3caf4399@gmail.com> <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: <007c0317-8819-a6b8-fdff-c0b5899c4f51@gmail.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5033C4000F75 X-Stat-Signature: het4yx9e93tkmjfiah4dcgooefxhkcpp Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail-pg1-f178.google.com; client-ip=209.85.215.178 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616180630-934912 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 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_ko= bject, kobj); > >>> + > >>> + kfree(cma_kobj); > >>> +} > >> > >> Oh, wait.. I think this kfree wrong since cma_kobj belongs to the ar= ray. > >=20 > > Oh, good spot. Let me use kzalloc. > >=20 >=20 > 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 th= e > 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. > 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.