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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 93482C433E0 for ; Fri, 5 Feb 2021 12:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37FE164FCC for ; Fri, 5 Feb 2021 12:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbhBEMPl (ORCPT ); Fri, 5 Feb 2021 07:15:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbhBEMNE (ORCPT ); Fri, 5 Feb 2021 07:13:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 177F0C06178A for ; Fri, 5 Feb 2021 04:12:24 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);