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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 6519FC4332B for ; Sat, 30 Jan 2021 09:24:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A9C164E13 for ; Sat, 30 Jan 2021 09:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbhA3JYK (ORCPT ); Sat, 30 Jan 2021 04:24:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbhA3JVp (ORCPT ); Sat, 30 Jan 2021 04:21:45 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F87CC061356 for ; Sat, 30 Jan 2021 00:49:02 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id v19so8217395pgj.12 for ; Sat, 30 Jan 2021 00:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=VPPQK3MYARFNPka0GW0BKWI8SGFdjK1DBHoMEVMkIm4=; b=Qsey4FGl9nvu2x/jd6bpXS3rKOqLJXy9LdnmzyuLg7dsH4D+8c2CNWzJRbJonj43xp HfrIZGFojh2ynt8QDw5pcamIGbuHWVLVFCXjvRUVqXXFpkJEwwbUHsd21nEcWbwsw/oi piwkVpbCOb2pg/enEafEo+HVTV96UfBecfC2l1lKJxeVBAclkpg4AvMpoxEYXSOQI0gk 2wj2nS5ulquxkpqA/zaj1BRfxG5s6jPQ1hWy3Sy9+BhJRSojJx7w+x1FuA2jiVzhAPHb mMutHNQbcJQSi7klFYeKolkGTR0SkOU3plbrRYnCfBIkdVE0PjifvhPBetl/uIa0IQww j59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=VPPQK3MYARFNPka0GW0BKWI8SGFdjK1DBHoMEVMkIm4=; b=s0WLrlcdfQkFn0bHxCQjEoTz7EbfpCuH9Usky3KcnBBgx4Dz4gqYfS71StRamLvaPc zJs8lmYgqaV0ac0IY4ro0sEFhT5IAtyla3LsLTaOSM6rCF7x+Gn+5yyGOQaB4cby7YyP 6Y0Y+v1GOGcVEnrufYP3a0yVVp2g+FBQOvvuqX/1N8xMP980VQHlExm8cL0KOKVLwBSn Xm/eAnpzDvxPUGvcT1WyF9tNGR+VYvP7dhSv9b/IodqBzyhYQ7hllVuV70jJIlGijir4 2Nws2lwJ+kOY2zokwSO1ssY0bVXfwlNgvxfSWgrQCtJJZPBsa2tuARnC1qkG6ZMLde+5 L/VA== X-Gm-Message-State: AOAM531DfwYFGA49Jg9O+E8Ekz+ZA0iiX0+IWTdhbkgGxfKkOMFwxYhg FiRBdFY0tjlyAGP+lZqRlboECl4pXrZWXQ== X-Google-Smtp-Source: ABdhPJzpYIOdqiFPbQlzZUqRBC8ZCwu6SwcWVnHq3VTBCRyWFiNZQGTzv7ubm6hfTHvk8Mxu1WMgBA== X-Received: by 2002:a63:e54f:: with SMTP id z15mr8201841pgj.247.1611996541042; Sat, 30 Jan 2021 00:49:01 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id p7sm10888408pfn.52.2021.01.30.00.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 00:49:00 -0800 (PST) Date: Sat, 30 Jan 2021 00:48:59 -0800 (PST) From: David Rientjes To: David Hildenbrand cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Thomas Gleixner , "Peter Zijlstra (Intel)" , Mike Rapoport , Oscar Salvador , Michal Hocko , Wei Yang , linux-api@vger.kernel.org Subject: Re: [PATCH v3] mm/page_alloc: count CMA pages per zone and print them in /proc/zoneinfo In-Reply-To: <20210129113451.22085-1-david@redhat.com> Message-ID: References: <20210127101813.6370-3-david@redhat.com> <20210129113451.22085-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Fri, 29 Jan 2021, David Hildenbrand wrote: > Let's count the number of CMA pages per zone and print them in > /proc/zoneinfo. > > Having access to the total number of CMA pages per zone is helpful for > debugging purposes to know where exactly the CMA pages ended up, and to > figure out how many pages of a zone might behave differently, even after > some of these pages might already have been allocated. > > As one example, CMA pages part of a kernel zone cannot be used for > ordinary kernel allocations but instead behave more like ZONE_MOVABLE. > > For now, we are only able to get the global nr+free cma pages from > /proc/meminfo and the free cma pages per zone from /proc/zoneinfo. > > Example after this patch when booting a 6 GiB QEMU VM with > "hugetlb_cma=2G": > # cat /proc/zoneinfo | grep cma > cma 0 > nr_free_cma 0 > cma 0 > nr_free_cma 0 > cma 524288 > nr_free_cma 493016 > cma 0 > cma 0 > # cat /proc/meminfo | grep Cma > CmaTotal: 2097152 kB > CmaFree: 1972064 kB > > Note: We print even without CONFIG_CMA, just like "nr_free_cma"; this way, > one can be sure when spotting "cma 0", that there are definetly no > CMA pages located in a zone. > > Cc: Andrew Morton > Cc: Thomas Gleixner > Cc: "Peter Zijlstra (Intel)" > Cc: Mike Rapoport > Cc: Oscar Salvador > Cc: Michal Hocko > Cc: Wei Yang > Cc: David Rientjes > Cc: linux-api@vger.kernel.org > Signed-off-by: David Hildenbrand Acked-by: David Rientjes