Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp183018pxf; Wed, 24 Mar 2021 02:29:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8sJiu1QxGGhSySxjGk4GDmGUb7sOz88f1OCE8xu94781eA9SEV5rXDrTvU2ZqZGAIRevr X-Received: by 2002:aa7:d4cb:: with SMTP id t11mr2380176edr.202.1616578147908; Wed, 24 Mar 2021 02:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616578147; cv=none; d=google.com; s=arc-20160816; b=DWT/IYj0g2Pn10DN7AIRaESOAzzG/BO3laYSHbBbtmxWZMUNel3Qm3VVaDmNqEvB0X bBl51zf5lfbcDgXjinkJvQ7QL66BYxIY1h/3IvPbOQSSuNWqk+r66gLbN4yrVbyC+Rde 6LQ7+HX37yibpz4VF+v5wop8r5dlHXkZZ2PoNSepsrNKxwi+6uBNxbOruN+MAoysM5Qe HVj1tOgG0gvxtlL1PaHU0+Qyep51bNpVpcYCrF1n3WKoKav4BwjW5V/796pFl4AhQ2EC j29XOhb24X74e9Fmx28APqA0KDozMESVlAO2koNu9rsEcmqmgJukHHfF9A/+nLVm8RRC cVPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ak58R9ppaBaibHUKtsrX/8kQSpkyoQcxYj1ybi6FKGg=; b=cEeNt0VhsazBrsiYtiHH+LdGgL6my6vM5J2uReTPrTqG7CIr07gTmXUjfeUn24HUCo 2On3qv03L8f9xLGU0r0BzTpvIT/lhMeqeOcZOnWvXjppxLIQUOrNC76HxCOW/5xM3bhh Mi+3q24FO6qgTVtzpW6h4E3VNfFaOaKUz4HiP4iEJKVjs2L1oh9Rn73FA/SHfxVdlKB9 Lo4eleaPZUwknRwDUoc7UtXlvTIFgkHiGYcKuy+HP4Sunx69xrVkELZQGoXyA2oK0FDM QNaVWuwFbJ8X9SztReqmj7WV4wOcyM2FU8GJ9e9yHa3fTWj3jb+GQQO0OU0GojS3zNbh s6bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XnVPA8W+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si1347026ejk.730.2021.03.24.02.28.44; Wed, 24 Mar 2021 02:29:07 -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=@infradead.org header.s=casper.20170209 header.b=XnVPA8W+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234987AbhCXDDL (ORCPT + 99 others); Tue, 23 Mar 2021 23:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232312AbhCXDDK (ORCPT ); Tue, 23 Mar 2021 23:03:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB88C061763 for ; Tue, 23 Mar 2021 20:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ak58R9ppaBaibHUKtsrX/8kQSpkyoQcxYj1ybi6FKGg=; b=XnVPA8W+06Gb4w5qHIAcSFjSbu LgG4D0IIObSiMqKNNUNIv9JA+Mf+aQxaHeSjSKnIg0jUyB4sPr8/OL5YsLBFvXeO6awA77Wc3pFKv sKSIvUwzlq1ETQpM7lCp1tRZ8uoNbjzuhNZL4iiURfzCdrfPSVfzoGXncw+eg7swztK0ACN2jHtWV V/uDgDDY4lFGN/ydCJVSrI4+OByhWOM0a1M/w9T8azFAcqEIXMVB+wkNEjylahsX24xccK/EuQU3v zXMPnzZp2ImBULAkZ07HH++gK25Qe9pb2VdXi4/CCnkyBkpTb4+TCS9xPXqOl1thSogfev5E+5wxh NeJwujJw==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOtmq-00AqRi-HN; Wed, 24 Mar 2021 03:02:27 +0000 Date: Wed, 24 Mar 2021 03:02:24 +0000 From: Matthew Wilcox To: Minchan Kim Cc: Andrew Morton , linux-mm , LKML , gregkh@linuxfoundation.org, surenb@google.com, joaodias@google.com, jhubbard@nvidia.com, digetx@gmail.com Subject: Re: [PATCH v5] mm: cma: support sysfs Message-ID: <20210324030224.GO1719932@casper.infradead.org> References: <20210323195050.2577017-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323195050.2577017-1-minchan@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 12:50:50PM -0700, Minchan Kim wrote: > + /* the number of CMA page successful allocations */ > + atomic64_t nr_pages_succeeded; > +void cma_sysfs_alloc_pages_count(struct cma *cma, size_t count) > +{ > + atomic64_add(count, &cma->nr_pages_succeeded); > +} I don't understand. A size_t is a byte count. But the variable is called 'nr_pages'. So which is it, a byte count or a page count? > +static ssize_t alloc_pages_success_show(struct kobject *kobj, > + struct kobj_attribute *attr, char *buf) > +{ > + struct cma_kobject *cma_kobj = container_of(kobj, > + struct cma_kobject, kobj); > + struct cma *cma = cma_kobj->cma; > + > + return sysfs_emit(buf, "%llu\n", > + atomic64_read(&cma->nr_pages_succeeded)); ... if it's in bytes, it should probably be reported in kilobytes and be suffixed with a 'K' like many other stats.