Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1413471pxf; Fri, 19 Mar 2021 06:49:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfFTcKbg4CrOXhHy64hMa6/RQWwrtYe5Ex9nCZoimhqK0It4OYIabVNCdoJR0mm1Z7E+Jl X-Received: by 2002:a17:906:4410:: with SMTP id x16mr4451230ejo.446.1616161786048; Fri, 19 Mar 2021 06:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616161786; cv=none; d=google.com; s=arc-20160816; b=Uua/rY/AMmoPwjeA8XtOMFCBehiqYPBPiOXRws6wNZRwMB9BSf+WtfJ1Mb0LghKI7G HInkU9sw8/r+r+24+6gZzN5TB7xS83Z19/1S4ewcQWP/7OU8qY+cKxvmcFcM3WnqlKvL p2hkfKptYF/0refIn4UcCuyp4tMNpkem+hu5t73XO+WusmVCpAK4Y4EIalyuBcfSuw0w d/9dS+uBlSlJWyjRFol9fmH2O2TLwe31juMk3V/neUewmDIwIlHqyRgbP8fC4tIYkxYJ 4d3R3ZwYEPT76OfH1OUaCwHxH4zvb8TSOMPRZAc27ZAHziB3e8KHGvOpg2AgPKs+Z21G NFVg== 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=m9KRUi07hyi/erPB7Z6cmTUYvTMuSexeYijpRRYF2KQ=; b=i/ZMe0O0GHpOQwCquKT907gq+zTCFvD2ybNrYgOoWiuM/TLUvwAJyrRFd04qDx6Vrf cCtd9Efafco9F6CBy8vNsCSE3mVUzw/lsAIFIbyCXYM/QlRaZBBraRkw9lL/9IET/xwT YUyAF/bUn+od5GQXzyfXgTym9wPiwcKXhPUb77fYkjfr7iHIvt61OfDoltfcjb2aAYK9 MWcE4oy+Wi+/x4u9cwzhoVA8drtrOnjY01h78VWgQ32dVdewem/6i53JJ4s9U0t6W/8P EvSwxrAvDUmRd+syJ5UeaXLk3Whp0PsnpMfkkQF/JITe3ePzK7pRqLFo6OJKcqs8F62S P/MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z3L77dQq; 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 le4si4452146ejc.684.2021.03.19.06.49.22; Fri, 19 Mar 2021 06:49:46 -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=z3L77dQq; 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 S229844AbhCSNr5 (ORCPT + 99 others); Fri, 19 Mar 2021 09:47:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbhCSNrr (ORCPT ); Fri, 19 Mar 2021 09:47:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 116B464EEE; Fri, 19 Mar 2021 13:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616161667; bh=hEfaNvDeQRC+DdyeCwn/ZVt7kmSSXJFmb0aCVkI39h8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=z3L77dQqHlXpG1l6/gS4TZeeZPmDrPZGaS8pwvTw3S8xWXV76/dcHkKp0XnrpN4zS LuorjNU5I+kEI1B3VowU0wrfdHW2hMQ34OTWH87OVCzkb+C73hZzSY+D4f2MqyMvco gVvcE/BNLl3rqU9kd6A+US/Rtt8HCFejYAnawiAQ= Date: Fri, 19 Mar 2021 14:47:45 +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: <20210309062333.3216138-1-minchan@kernel.org> 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 04:45:21PM +0300, Dmitry Osipenko wrote: > 19.03.2021 16:42, Greg Kroah-Hartman пишет: > > On Fri, Mar 19, 2021 at 04:39:41PM +0300, Dmitry Osipenko wrote: > >> 19.03.2021 15:44, Dmitry Osipenko пишет: > >> ... > >>>> #include > >>>> +#include > >>>> + > >>>> +struct cma_stat { > >>>> + spinlock_t lock; > >>>> + /* the number of CMA page successful allocations */ > >>>> + unsigned long nr_pages_succeeded; > >>>> + /* the number of CMA page allocation failures */ > >>>> + unsigned long nr_pages_failed; > >>>> + struct kobject kobj; > >>>> +}; > >>>> > >>>> struct cma { > >>>> unsigned long base_pfn; > >>>> @@ -16,6 +26,9 @@ struct cma { > >>>> struct debugfs_u32_array dfs_bitmap; > >>>> #endif > >>>> char name[CMA_MAX_NAME]; > >>>> +#ifdef CONFIG_CMA_SYSFS > >>>> + struct cma_stat *stat; > >>>> +#endif > >> > >> What is the point of allocating stat dynamically? > > > > Because static kobjects make me cry. > > > > I meant that it's already a part of struct cma, it looks like the stat > could be embedded into struct cma and then kobj could be initialized > separately. But that structure is statically allocated, so it can not be. This has been discussed in the past threads for when this was reviewed if you are curious :) thanks, greg k-h