Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1652060pxf; Fri, 19 Mar 2021 12:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv3gMVBS6pTZ7nYou4d/hCtDHZ+4V0cQWelqXgmcX4nGtGe9NJcSGqEY5zfAj13GdjbROr X-Received: by 2002:aa7:db51:: with SMTP id n17mr11706526edt.259.1616180841035; Fri, 19 Mar 2021 12:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616180841; cv=none; d=google.com; s=arc-20160816; b=09mkPpO5X11XW2IO75RUleoXkLrgVUPHh4Ihtus5XhGt8KgtL/DEQHU8iZAV24c3U8 6vhVeJNERk7jH/8T5tm7b/otcZvQStUdTLehydK1mBkZqaiAov8UjYVl8vPF28wBqNUi AG6Blrfde1DHxxNeSWTJy1ZoFxpphdSR+EsPq8T1eDnvWR0uC07R7iVgL0LZPNITh5Ms /fMyvyPTGSchdeoNQDC/7k20zn9zy8kLzuznWkWaYABmlaESz0mZvUFktzeZAjgoAQ24 m/1sEnl64gnsiDHRZQ9nrExxvF1gUTfGoYQD+wKD0/+iWoGjXFBeC3XWcu7zaNKgUvCv GtQg== 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:sender:dkim-signature; bh=RY4pLK9k4mNEtiGyVCqmRISme5ShUYMejZygdlUQWa0=; b=i33IxFiyX+EShzg7jVyPzwztRfQl2o4rT45eGpZo21vFIcLvS5RwBKQPE5g/Sfxcmw bf72axPwVq7+XakielGbH5ydA+HA6rr7q9ySl3N2lQUqraKphiD2DcVTqJw9YKJCG0qi 6em528woqIVIlfD5WCKbjJxKnLPQDGhHsicnlHeautrcJP3xQcN4BnQRYof4puUuirxR 9XseXieffPf8U4pTHE2on/scOeQxJnKeUkE1C6dhdwA/FbJUpKFFT7Fc0O9juijAElDT IM28rbZT3XRtP52z+p27njwN7tejOJoQpSwfuQMa/R3Sg1Njrz49yqQhBXefK37xW78G eokA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZxCHUCqm; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si4939295ejj.303.2021.03.19.12.06.57; Fri, 19 Mar 2021 12:07:21 -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=@gmail.com header.s=20161025 header.b=ZxCHUCqm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbhCSTD6 (ORCPT + 99 others); Fri, 19 Mar 2021 15:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbhCSTDu (ORCPT ); Fri, 19 Mar 2021 15:03:50 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569D8C06174A; Fri, 19 Mar 2021 12:03:50 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id l123so6558321pfl.8; 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=sTlt5kytEqHrOChhHVuo3jmr158ErWz58YLiB0TldSvealRPx/lqNmj8OmIdl+eXM8 9lEyuvIobFoV503BrAgM8gHjwTBC150VuwHkb+3iN6w/+Burl8iGs3O5Cqu6FeiMOHfW DJI21hzGUb/CEwaFslPoinhA3sA9skDLlFnBiV3VpQLhkuXXmFpX+luMK/IQRlbioxji R4p2E2uT97BHXacaI+tpxIMINd9vdzST2AfcHl4t3rAKBFAZdlD2iCnxEK3uBJGSZcqy GsJhadn6H57MDvFZa6T8/KTCQrYxsWB31B2WX4A14LWJtlIQjNgTfcbiDY/04g+Q9Pj4 BBJA== X-Gm-Message-State: AOAM532s5hRsrq/SSv0bzlunKgCXvnLOKDJFR4biBa77ei0+J8nn43x9 WYPT2z9LVOXm0DEWtGXWtAo= 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) Sender: Minchan Kim 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 Content-Transfer-Encoding: 8bit In-Reply-To: <007c0317-8819-a6b8-fdff-c0b5899c4f51@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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.