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=-7.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 2475CC433E6 for ; Fri, 19 Mar 2021 14:27:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9469764E07 for ; Fri, 19 Mar 2021 14:27:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9469764E07 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 142B46B0070; Fri, 19 Mar 2021 10:27:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F34B6B007D; Fri, 19 Mar 2021 10:27:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAEF26B0080; Fri, 19 Mar 2021 10:27:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id CD3346B0070 for ; Fri, 19 Mar 2021 10:27:57 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 86FC6640E for ; Fri, 19 Mar 2021 14:27:57 +0000 (UTC) X-FDA: 77936852994.31.602950D Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by imf23.hostedemail.com (Postfix) with ESMTP id 3BC0EA00140A for ; Fri, 19 Mar 2021 14:27:54 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id f3so1952549lfu.5 for ; Fri, 19 Mar 2021 07:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=EskRbslmKbHjaKU+UDZLjwhTtBvfQ+OmXt0bCDAxa3M=; b=p+eaF2s28WuIMRbDYf8y4MluzVjXZR3aBo2mauhDZosyMR7QLnkjG/KK+uZNBV6CR+ CUL2QHPrcm8bERUL53i3zHvUUiW/5DtVoKBPTN++mX1rGaAovgGGcEXDsLKGb2JFDNkA U4iypo2QPz94N3txG3DUAsNqBqAgnz1PUyHMJjKrS+8GFmGJJ1GoxbI1dzGOK/igwH0Y QGuBdYtvii2L/T4XAXvSgVqYiojO4on/2T5GbzHJ9ClEqPfVicj1mg+bAH37isM7/Y3o dc91sk305Y5RwRcg2xjxOvToyLs+1of0uJAGyNyR+0rWER/mIkFtdPTS5NzHS8UVLF87 xpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EskRbslmKbHjaKU+UDZLjwhTtBvfQ+OmXt0bCDAxa3M=; b=XV+f/AkqRPBRrgvjgS/VXSdjO0lxpyEy/f6iEKSuZsXFDJ+4IV2OdPbZytFatVpD7m SXlSSXBWYHD7IKhfTOuw3nwxkitv0u+ZBDP2WZ0tUSh9Mhy4N4LFsHzlsAJhUDR76V/D 2oebgbRccTK7ovl+BH+Jo12NvYgl5daS/G+NEiOpUDDScYoW4bSOrhYd/6qAZ+L1NGP/ OReyPgpur0jHWDLuYjZqx4XLiEv+FiAtyHeAWsnpJ0XlYNLI5ZXp6JGm/nL/abP8qwTj wiP7d6eIoG0spoNnCdpAQ6CcR3beI4INHpOU1JONVpL76M3m14MNIzNrBhZSiNsL0Gws qMYA== X-Gm-Message-State: AOAM530C3VrAWzKjxjtXeKFEivpwCWkAQxdDvJdmUQxQA5JOMgLUi/Wv 4aFY9xcrZgtz4DlJKQ6Twfdn3TKMgC0= X-Google-Smtp-Source: ABdhPJwqTDDxWCe02fqFjJYUYMviMZVqHnWf7RSMGz5pKcYWxbA5oMNSEnvi9c/Om1TycF1eDjebvQ== X-Received: by 2002:a2e:974d:: with SMTP id f13mr1088059ljj.210.1616163588670; Fri, 19 Mar 2021 07:19:48 -0700 (PDT) Received: from [192.168.2.145] (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.googlemail.com with ESMTPSA id i22sm782341ljn.56.2021.03.19.07.19.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Mar 2021 07:19:48 -0700 (PDT) Subject: Re: [PATCH v4] mm: cma: support sysfs From: Dmitry Osipenko To: Greg Kroah-Hartman 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" References: <20210309062333.3216138-1-minchan@kernel.org> <33ec18ef-8652-643a-1a53-ff7c3caf4399@gmail.com> Message-ID: Date: Fri, 19 Mar 2021 17:19:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <33ec18ef-8652-643a-1a53-ff7c3caf4399@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Stat-Signature: 9zho3y8j64u9smxce4ctsaja5cisxera X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3BC0EA00140A Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=mail-lf1-f42.google.com; client-ip=209.85.167.42 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616164074-363550 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: 19.03.2021 16:51, Dmitry Osipenko =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > 19.03.2021 16:47, Greg Kroah-Hartman =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> 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? >>>> >>>> Because static kobjects make me cry. >>>> >>> >>> I meant that it's already a part of struct cma, it looks like the sta= t >>> 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 ha= s >> been discussed in the past threads for when this was reviewed if you a= re >> curious :) >=20 > Indeed, I missed that cma_areas[] is static, thank you. >=20 And in this case should be better to make only the kobj allocated dynamically instead of the whole cma_stat.