Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1416489pxf; Fri, 19 Mar 2021 06:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpwkOaoZLQQNwgajehY07TSAwuQlfZGVjF1RSCv1bl7NXqimmH+g53KOu6W7CfFkZyEduG X-Received: by 2002:a17:906:8a6e:: with SMTP id hy14mr4494213ejc.356.1616162008604; Fri, 19 Mar 2021 06:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616162008; cv=none; d=google.com; s=arc-20160816; b=LF8v2Dv3JxWy02f6bINDk8LOoKoNDgI7/1WcjNQsJIxOEkg0MbAIGP1OOCL1hmUFGj l9D3zUE9RpDgIOttrJPVPe48/qCgEK0Yav2f1BZwII1J7HrIFUDsd1BI4oGy1CRWTIbv iMhNq0Mybd+09/gcT/k2urWJcc1JqelEZRABfmdFHEWhGhXFLNt5OOYcq7pEM2ReuA5d hdyE3+7ukFxyK6eVZTDQvYlGzEUjMEfXdw29FtAkxC23rhiFlwKnysWyQiZ3rpm0psNO 6AA+D8NtDoQE68EB1mQ3vnrD6EisyWVdKfVzELt8MEJwaH9N0y11VJKgt1gNqrv1n38a fW7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=oLPdjYIPAAH3VAO0voDj/31NSP3unxZEaytASrJzvmI=; b=fGd4IpDcWNLqD3PfLgawz9Rkeo2x8RXXzFumhfXiM4rzAuSj5F6ZxwZ3NsuLP/S8/Z Na8Vuab2L3ogTNU/sLOAP5y3xrD0Nw2NhiU0iKzCzDBBwZLG6FdERMfuCUVV0DvoPngd n3U3jERxo53iNqn2Tq/EE1xBxqL9zwCYvZiERtVvy1A+gFuXk9izACnOHljxbq4Um7eY lpyAJUJGtnjYrZAxlcmJioNAOg8jL4aa/PCek//Lt9wVKJlyguQdcNNUtRzSJMoU3Wej Iy7vGm2pcEEx7zpcfiYzZmTDxJcBEh9A7GJs6XHWEaC1UQ1QVR0dNjWEphlCdeK8humn GkKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GUxde1HF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si4242538edr.396.2021.03.19.06.53.05; Fri, 19 Mar 2021 06:53:28 -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=GUxde1HF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbhCSNvo (ORCPT + 99 others); Fri, 19 Mar 2021 09:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbhCSNvc (ORCPT ); Fri, 19 Mar 2021 09:51:32 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A12C06174A; Fri, 19 Mar 2021 06:51:31 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 184so12046733ljf.9; 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=IiChN+XonsoDIQRVROEfvtqbkD0fEYdbyxuNcvRVWMWDCG89N9c7ZWaf9gRfpKRD49 L37SwjLoVRIWbRwl/6RULCJlZqrcMzjYQZfnkoCY7wDpAkpBsA1GC1qWPs3ZvUQI0XIk 6SJ/Tf6stjQt2yj3uuf2vgMdT0RtKtg6ZV5dkY/vKV2f96xWDij/FIpgT8VOFD9CF7yS vmzgvh8wvXGSYCnxgQy4LF2ykLmGudjSU5s/Jp28kjk7YIjT+iRX5ybgOiLeGYL23hJX R7xVe0QGACLfl8HiaxgFBd1YZ81iigVhV1Fub40ZUKQi35/5wq/iO6dcjV7ynE6ksKCe 46tw== X-Gm-Message-State: AOAM532vJEzwIKoFqeHHyYNPZnGqAMj5skYQo8M2MqhHITdF29ulPevh hqvACmJtu+I2Pi10iWgUhYqWHWmmea4= 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 19.03.2021 16:47, Greg Kroah-Hartman пишет: > 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 :) Indeed, I missed that cma_areas[] is static, thank you.