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 92C4BC433DB for ; Fri, 19 Mar 2021 13:51:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1ADC264F11 for ; Fri, 19 Mar 2021 13:51:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ADC264F11 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 ABCF26B0072; Fri, 19 Mar 2021 09:51:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A937F8D0005; Fri, 19 Mar 2021 09:51:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95C5B8D0003; Fri, 19 Mar 2021 09:51:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 7B3AC6B0072 for ; Fri, 19 Mar 2021 09:51:34 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 37267824999B for ; Fri, 19 Mar 2021 13:51:34 +0000 (UTC) X-FDA: 77936761308.03.028EBDA Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf19.hostedemail.com (Postfix) with ESMTP id D0EFD90009E2 for ; Fri, 19 Mar 2021 13:51:31 +0000 (UTC) Received: by mail-lj1-f174.google.com with SMTP id z25so12063836lja.3 for ; Fri, 19 Mar 2021 06:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oLPdjYIPAAH3VAO0voDj/31NSP3unxZEaytASrJzvmI=; b=GUxde1HFjIYz/CKP1DpIs5j+5n1EHGFyYGW/pM6B8wVy3gtttUB9zitCNrFp0fn4x8 QV7jJqXrzTsPqtuaujCoypPE2PP2rBG2lJICB8kM2bwggPnFec2NZKOW8uIY3IGAIHeN Y1YkI09MItoPc5ieQ88QOIEINTuz0SN7SdrcZpbl2IXvyMQqHACthCprNHHJm8N8oYzD mwuU+Wr2XDXjgwfS/t2+w/IAGqZ71bbA4/bgXbukBP4Ep7vTRXgzi6dCB5ntpBZTuH/T 17riSZgw+CwFRF18uwEJXBqOYHwnvtB+UqRM+zMQa+p3BNvtrye5PSV1sUEe+6Kyc/LC sL6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oLPdjYIPAAH3VAO0voDj/31NSP3unxZEaytASrJzvmI=; b=S67R/JDS3V+q2S92qbcpLGU0VB98Lt2cL6BS565qDBg/qAINhgQTecyEDj32371hRD xXKj9axDNKsylfdAZZsb5qzX2GE5HrY1wUJITbj1q6J7JegjCCBrW1S+p3J3Nehx89Ci wsX3IaZvl7jx4s6wZ/Sh1awTRKXfF7Wyrq1O99N4YgPIWGCS0aBw+bIoaWu5rwuzg51a K8EL6k3qbC9DeYb1m20uF0BbYpnExoCDmH+P5X3FjkclmsK3GGT7HzODXwM3JbsgoEnp GGMo/Ecj6P987r5C4ivKWyt7OmYPsQFjzu3Ji6AWCK3Z0ohwuP6mQxsIeLot08cvfHDS +zBw== X-Gm-Message-State: AOAM5339UjvUxrSb/uToZAYIRl1qr4KVlfNAPU+5vRz7Lu8Y2qiZ9EOA bQ7SsPgznPVc6rsh7jI9ebc= X-Google-Smtp-Source: ABdhPJzKM4AnZRZRCL0dQF7IX3NYzdhDVFTcfSJCiIekkzRhxQWUUihQ5OSYLd8vj8AXVScP7mFvsw== X-Received: by 2002:a2e:b4a5:: with SMTP id q5mr1023485ljm.7.1616161890344; Fri, 19 Mar 2021 06:51:30 -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 x29sm642880lfn.60.2021.03.19.06.51.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Mar 2021 06:51:30 -0700 (PDT) Subject: Re: [PATCH v4] mm: cma: support sysfs 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> From: Dmitry Osipenko Message-ID: <33ec18ef-8652-643a-1a53-ff7c3caf4399@gmail.com> Date: Fri, 19 Mar 2021 16:51:29 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Stat-Signature: eya7iwesnbqn4j4ew3hhmirge6rr58dg X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: D0EFD90009E2 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-lj1-f174.google.com; client-ip=209.85.208.174 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616161891-609209 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: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 stat >> could be embedded into struct cma and then kobj could be initialized >> separately. >=20 > 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 ar= e > curious :) Indeed, I missed that cma_areas[] is static, thank you.