Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp199102pxf; Wed, 24 Mar 2021 02:59:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrFErn4cVMUXwpe3aXQqfA1mXLEWEepebwzKIvVQ0j9vfWnqefG3OOCIllidqHwXHVHYkd X-Received: by 2002:a17:907:2513:: with SMTP id y19mr2708185ejl.241.1616579981552; Wed, 24 Mar 2021 02:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616579981; cv=none; d=google.com; s=arc-20160816; b=EKLdhqL2m9d3PXRzQWxcu29deTii3KGX/qsco23a7+G/wju8S4LD5+otPJF2c4mqrj QP7pCXo05VIOW+ClSMD5vEAh8fzr+wwBBs4VN8dxl/VMoLLC7c7O1l/aLqQTW97KSMkr 8u3SSZDnYzqAllmq57daV5cbfA3f0qZQq7bIqHMruLXk5pENgxSQW2DEAPdZEAutFmbk wSTyKInwaSuo2TCsLdlvc4WIgq1qrQUGOFc7ePfYbzA6hzLHR11TiYM9DiH+Cjggx9eF Py96sbmLtfVrAIRRW2LItd8mKwNpuOLTO3mGQy3xQf7/iE+GffbdrxjS1Nlay2IXKP7E ZvSA== 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:sender:dkim-signature; bh=pK3YDZrisDgTcA/2AaWj7g0kwUq/wxiA7K4Ee2UeDHU=; b=KfdErlppKaDQexDBpLrW66pQcrZ0UlKiQl5QSKFI0mA0WIctE4hbsxJ3rZZSej6WO8 eFBOeOhIsoxPuM2GPruGwAAVxI41eLLj0fWsu9NZ+fPTaqUSvfY9oS1+6C0kBnW772Vs ltwrqO/jyKmXj9LRZ7KPWg6RpeQv9m0d7rfFN33hbCRpJwHNVkpljU45uivOUz59v36U 7njld3cVRwAguKRChtG/kn64wDyB8Cr5fq5dTgNqDZXy0DgK28s/heZNRTPjJ/DS8RxJ /LTRuCeDpHgBTk7Vwr/e7rbBrFWA6YZ9AaTFlkW/q9EBjsKOJ2qOV10hX0znpqN8H2Jf 9EXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=imz7CzxE; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si1325111ejz.585.2021.03.24.02.59.18; Wed, 24 Mar 2021 02:59:41 -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=imz7CzxE; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235252AbhCXFpV (ORCPT + 99 others); Wed, 24 Mar 2021 01:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbhCXFpR (ORCPT ); Wed, 24 Mar 2021 01:45:17 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F08C061763 for ; Tue, 23 Mar 2021 22:45:17 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id v3so13915099pgq.2 for ; Tue, 23 Mar 2021 22:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pK3YDZrisDgTcA/2AaWj7g0kwUq/wxiA7K4Ee2UeDHU=; b=imz7CzxEmupMHWBJCSBjziqXtI4nwrPVGcLYRZ6Xp6Z/w6HEbhsdSiEd+Z6AiZPqpB WKmR0kw94j0J8ty108744ekYmRysGdjMZ7TLkaVzTP+iXuFxmerIDQsld1z6W4MBTu4m SMZFQqjJzcoIB2QnhUWtf1040ry7E6xl3IplA/gn/5XJuV7Ak0h2jiRhYTCKWWtPliDl UJRdbOvL3Pydq+okU9ggKEOeXYembtXNy/qhWHYtBLHneOBjkx7ebFIi1rn7UW2Mhy+t C20kdY/hMzRI7UxNNIuAbp2kRPyItsqEqeu6R7W+AMQ8TX4bsS1mkMRnvlRQ2FmBkE4L R+CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=pK3YDZrisDgTcA/2AaWj7g0kwUq/wxiA7K4Ee2UeDHU=; b=UQJUDcxm0eH6BA4n3gDDbElWxfniPq7juoCGkvxeKQm4MPX8az91rz3WZxygbEIh4O EHMNqTDV7huxB5wyo8FPCuz3MEhBXMkT9XKsLJjDNbnDGgAL50B+Jh08JfTCQU8wyFWD YXh8+u7m/Xlc/i3T7F6AvHVYMbU+Pg4+7Et/mZBjDGRaGoYJ4vmG9g14jDaUrE5Plmmb nzYN9cb0Ds179BmnNxM+Lp5y+N3OUdri7cegrSo3ps3QkEEc+3YXJJNFkzDjPdbW9AYN rvTLuW6wU+ouLBqA9MB/waM1XZDNQ7k+3mVh0Hrbirpl4E9ihIG/zh1ljXUlayV5kdOu /TEA== X-Gm-Message-State: AOAM532nBeG2nxRORq9RkK+SIxYCJJB5V7V6Q28knAe9BpVVq1QY1QGe S83vD/2C+9BtoyjbHIVTzOA= X-Received: by 2002:a63:1d5c:: with SMTP id d28mr1542016pgm.315.1616564716782; Tue, 23 Mar 2021 22:45:16 -0700 (PDT) Received: from google.com ([2620:15c:211:201:7dfa:1e53:536:7976]) by smtp.gmail.com with ESMTPSA id l10sm945741pfc.125.2021.03.23.22.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 22:45:15 -0700 (PDT) Sender: Minchan Kim Date: Tue, 23 Mar 2021 22:45:13 -0700 From: Minchan Kim To: Matthew Wilcox 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: References: <20210323195050.2577017-1-minchan@kernel.org> <20210324030224.GO1719932@casper.infradead.org> <20210324043434.GP1719932@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210324043434.GP1719932@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 04:34:34AM +0000, Matthew Wilcox wrote: > On Tue, Mar 23, 2021 at 08:31:31PM -0700, Minchan Kim wrote: > > On Wed, Mar 24, 2021 at 03:02:24AM +0000, Matthew Wilcox wrote: > > > 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? > > > > It's page count. I followed the cma_alloc interface since it has > > size_t count variable for nr_pages. > > That's very confusing. cma_alloc is wrong; if it needs to be an > unsigned long, that's fine. But it shouldn't be size_t. > > 7.17 of n1256 defines: > > size_t > which is the unsigned integer type of the result of the sizeof operator > > Do you want to submit a patch to fix cma_alloc as well? Sure, but it will be separate patch. > > > Let's go with unsigned long nr_pages: > > void cma_sysfs_alloc_pages_count(struct cma *cma, unsigned long > > nr_pages) > > Works for me! Thanks for review!