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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 BAC32C433DB for ; Fri, 19 Mar 2021 13:47:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43FDB64F11 for ; Fri, 19 Mar 2021 13:47:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43FDB64F11 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 93A9D6B007D; Fri, 19 Mar 2021 09:47:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 910B36B007E; Fri, 19 Mar 2021 09:47:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D8536B0080; Fri, 19 Mar 2021 09:47:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 5EA566B007D for ; Fri, 19 Mar 2021 09:47:49 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0B3BC81D6 for ; Fri, 19 Mar 2021 13:47:49 +0000 (UTC) X-FDA: 77936751858.09.435EC0F Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id 8ADC42000242 for ; Fri, 19 Mar 2021 13:47:48 +0000 (UTC) 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 In-Reply-To: X-Stat-Signature: sgum6bi8x3eaex1cjjm9b6fgm5iasryt X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8ADC42000242 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616161668-178626 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 04:45:21PM +0300, Dmitry Osipenko wrote: > 19.03.2021 16:42, Greg Kroah-Hartman =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On Fri, Mar 19, 2021 at 04:39:41PM +0300, Dmitry Osipenko wrote: > >> 19.03.2021 15:44, Dmitry Osipenko =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >> ... > >>>> #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; > >>>> +}; > >>>> =20 > >>>> 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? > >=20 > > Because static kobjects make me cry. > >=20 >=20 > 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