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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 6BF3CC433DB for ; Fri, 5 Feb 2021 12:12:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 12D5764E30 for ; Fri, 5 Feb 2021 12:12:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12D5764E30 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5D9676B006E; Fri, 5 Feb 2021 07:12:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5640C6B0070; Fri, 5 Feb 2021 07:12:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4780A6B0071; Fri, 5 Feb 2021 07:12:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 2EE2E6B006E for ; Fri, 5 Feb 2021 07:12:27 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C79D91EF1 for ; Fri, 5 Feb 2021 12:12:26 +0000 (UTC) X-FDA: 77784101892.16.fire16_3e0f7df275e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 9F5FB100E690B for ; Fri, 5 Feb 2021 12:12:26 +0000 (UTC) X-HE-Tag: fire16_3e0f7df275e4 X-Filterd-Recvd-Size: 2347 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 12:12:24 +0000 (UTC) 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=L6mpUyb2tsXriUaxnJYzuNaLbxNc4mxLma6rOnf0vj0=; b=H+Q6G+KEvacqdLRfvY8ucy9m+u OZ/RyKqspgovjVJ1UxlwgrYXnNZDtIYry6P53zz7Vsmhul70qm6DztS61LmTO8Kj+KxXDTJi7YaV9 0FKo8kzRDDSMQqFSTpJuHnLOA2+QydDl89CRhQjrWWSoDrTVnjom2YtEcE95xQnMQQb6+ZkNOIRUW Lrg5uxjcihQKehxU3gyiLYzENN9dwBT4UF4VuoxEDZVMuSgwDSaKE2t1vuxFoLu5vB61bfsHrX6aB Dpvzi191o88+C9kzm7LnRIERZQ68DhM7Jgn/7YZI/sw2zkcQB4O7QiCKNuXhGlJ6qojzDb/W4yUSH /8atktZQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l7zyD-002GeT-Ku; Fri, 05 Feb 2021 12:12:17 +0000 Date: Fri, 5 Feb 2021 12:12:17 +0000 From: Matthew Wilcox To: Minchan Kim Cc: Andrew Morton , gregkh@linuxfoundation.org, surenb@google.com, joaodias@google.com, LKML , linux-mm Subject: Re: [PATCH] mm: cma: support sysfs Message-ID: <20210205121217.GH308988@casper.infradead.org> References: <20210203155001.4121868-1-minchan@kernel.org> <20210205025526.GG308988@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: On Thu, Feb 04, 2021 at 09:22:18PM -0800, Minchan Kim wrote: > > > + for (i = 0; i < cma_area_count; i++) { > > > + cma = &cma_areas[i]; > > > + stat = kzalloc(sizeof(*stat), GFP_KERNEL); > > > + if (!stat) > > > + goto out; > > > > How many cma areas are there going to be? do we really want to allocate > > their stat individually? > > I am not sure what could be in the end but at least, I have > 5+ candidates (but could be shrink or extend) and yes, > want to keep track them individually. I meant, wouldn't it be better to: cma_stats = kzalloc(array_size(sizeof(*stat), cma_area_count), GFP_KERNEL);