Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1443515pxf; Fri, 19 Mar 2021 07:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNS5Qr6XCdjUDT7pyDCkeI+f15Z/3NpO17ryMYj84VcOUw7XOPdkwKXRikqZvZRDtlSn3g X-Received: by 2002:aa7:c983:: with SMTP id c3mr9805684edt.185.1616163687334; Fri, 19 Mar 2021 07:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616163687; cv=none; d=google.com; s=arc-20160816; b=cID4ydu4l2Rl4zCiOa3YPNnaoKzrdDVqfvuJxuVbZ5CvAF0CQMNt2oUbDu4p0ZQn7l hzCnloMpPlMsmqYQZU1CXbf3LI+4q7Uo8DDRNwiY8vDBoCPqOYNlJrqMtr+bGdTQ4Udu DEFEpouJv4nFSGK9e4JHLEaOrR6syr1+01JScuWBpkiGyguQ901+ka8v94YlyxWUyfr3 bTv7rUrO2gH1gGrZ+PrQVJswSmGFiIZzFpca/sIz1qrTZF9BUcWsDhVtTBtD464o2jze 9tnHRRHu9dhPnyjS6M8JuDntAJEFCr74YXxFtD0IwBS6/FvIIi0kSAUDYXvEjo5IOkcZ TKFA== 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:references:cc :to:from:subject:dkim-signature; bh=EskRbslmKbHjaKU+UDZLjwhTtBvfQ+OmXt0bCDAxa3M=; b=zdMhHZkdR7riiKxO2GKNivnL2mQLnWG27KL1ZnAkk//WW6zaHjrzHKfb6AgM7ipLeW a/EOQqvZdq35cZ0Xbc1OXqHHQMqEXnxZa6l8x/kCZhd+Ydm/2YLku69lzX8islVnGBWW CqPD3tGieZazM7k7pl1VkaLRZY6CtC5mBKXeepz9bFx9K5nMKyh2xGJe0K1dQqgZikl/ CuPKyUyUSMOiuR+hsPc1vHE3k62u5v1Iai9aD7kAhc68/bz+0mLw4o7k4js+e5elaUiG hG5r8HX+Uf7ZNscZpjOZZpkI33X9jH05d2aW2//8DhL6nv8/A240E7IXammyJ0Yc65Cv Llmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p+eaF2s2; 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 c18si4193105ede.125.2021.03.19.07.21.04; Fri, 19 Mar 2021 07:21:27 -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=p+eaF2s2; 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 S229914AbhCSOTz (ORCPT + 99 others); Fri, 19 Mar 2021 10:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbhCSOTu (ORCPT ); Fri, 19 Mar 2021 10:19:50 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4008FC06174A; Fri, 19 Mar 2021 07:19:50 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id f26so12170540ljp.8; Fri, 19 Mar 2021 07:19:50 -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=bEestexkZuIAQeEkLQGK8iL6Wifz49bXjivIQr/qy5mnPMUwqk2wWzmBtmsBzekyCX 1eo4NdKggbTVe235UbNaX17MaY/qqfhuQ7le+7+OOzlRhFtaPloyQRd+BlG2S/9a2in5 /OfKU+I9g8A1B8onaYNpq58vMfNz6rtX155aMP/WbWkiNN9BivbXf6kzfBhFtpx3IBTz Is8SI6TrW34+Q8fuOaKTC5+9BJ1LZ+Jq9Ymbhm3KCgmL/sEy509U5eclymlmh26yTzfG 6hlaI7lWIKW3epSt16miMgNxfUy8l/Hys7jdG5dsfvhqKY/R51RmYpjF7HRSQDlwRWRc 5xiw== X-Gm-Message-State: AOAM530bDLR9AnQ+XtEx5cKlA/QQ7q65KI4l9ChrLMn2+G0m8N49DoV9 ClIVArujfpfYGTSr97iyjOnzQ3KT7BA= 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 19.03.2021 16:51, Dmitry Osipenko пишет: > 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. > And in this case should be better to make only the kobj allocated dynamically instead of the whole cma_stat.