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=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 27731C433DB for ; Thu, 28 Jan 2021 22:28:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8231264DE6 for ; Thu, 28 Jan 2021 22:28:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8231264DE6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CB0B66B0005; Thu, 28 Jan 2021 17:28:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C62AC6B0006; Thu, 28 Jan 2021 17:28:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B02CB6B006C; Thu, 28 Jan 2021 17:28:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id 956716B0005 for ; Thu, 28 Jan 2021 17:28:27 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 647228249980 for ; Thu, 28 Jan 2021 22:28:27 +0000 (UTC) X-FDA: 77756623854.21.jelly10_51180cf275a3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 46050180442E5 for ; Thu, 28 Jan 2021 22:28:27 +0000 (UTC) X-HE-Tag: jelly10_51180cf275a3 X-Filterd-Recvd-Size: 6131 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 22:28:26 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id g3so4169631plp.2 for ; Thu, 28 Jan 2021 14:28:26 -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=EU8Tm3K3oBlbbIeULtvbxU5p2tn0TQtZedwnNIY0Y84=; b=BgZAIzU4NSonuhxkBzNY3c7VaB8jSmmWONbtZOdYQ2id+Zm4dBNl3Td000Ay/R2Vka HZz13NCZDH7whsxHvmb0YNyd6VBfj3CYEfI2Y3wx7D41QkClnROSyUaMEVU4IWrmn8QN sOA4U26j0xUAErYAkMHrfo+uMIfEiPCQL9JXLbglEzeXG1qXZvH2jHSVQaEAc3b6xZRY LkKp6X1lRRi8pLYyIWcIL1+kjTiR/nF2DKWS4cwbJ1Rv385gkQz33y13ihw+dcBs3i7Y z4wAaYzPpICf5r2Uq09E59pO12nEXLdMArTYcW4Kf9e0jPIzP4WTDs1LAg4ANYYnrMZV Xrww== 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=EU8Tm3K3oBlbbIeULtvbxU5p2tn0TQtZedwnNIY0Y84=; b=WRaep6mcaG44jamd71FhkOhG3AxO4cxcF+tCQX8e4q//iRQFbmDdIe0CP4d+odlkDm sQaFVSXK08KKwepJjRPI8WlRVoR4FB/fN0ecjOlmARbLtss3XflIIu95Sp1WGKEIoiBr lNTkKF04cG2lOQ3t9C6OSj8dOBdVy8bVtp5lL+XPBD3/R9FfCGldbHRPCxARUPCGFbd4 uQB9j0MjqI/rY4g1zQYYsI0haj2aba6GMzfLBl8C3iwwIJuPvCOYuQPzCeFimOYqkGwh kkR/gO3I9drebn4r53L/P471qUeMP6+wT8uqQWqHLqtMdp7Bmct0PO6xb8KI4Kw+siCv n9tw== X-Gm-Message-State: AOAM533+g4aGsNIMjHqoGhWvVC124dBROPdZdPqVjNZctHyRfg70sj8A koVAdkhB2dCik+hi+CspWtU6RA== X-Google-Smtp-Source: ABdhPJzFe2/P5brnc2ev5Q8HoSO/uUHvj6D6QO6jxHq4qeewaCtN9jvyrggp2amIDjiWjiU/RgsauA== X-Received: by 2002:a17:90b:fc9:: with SMTP id gd9mr1429601pjb.107.1611872905499; Thu, 28 Jan 2021 14:28:25 -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 r30sm6872643pfq.12.2021.01.28.14.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 14:28:24 -0800 (PST) Date: Thu, 28 Jan 2021 14:28:23 -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 v2] mm/page_alloc: count CMA pages per zone and print them in /proc/zoneinfo In-Reply-To: Message-ID: <89e1dbcd-605d-6a7b-361-c130f7eb9d8c@google.com> References: <6d9cff33-39c1-ef8e-a18e-c865b95240b6@google.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1482994552-507496633-1611872904=:323143" 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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1482994552-507496633-1611872904=:323143 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 28 Jan 2021, David Hildenbrand wrote: > > =EF=BB=BFOn Thu, 28 Jan 2021, David Hildenbrand wrote: > >=20 > >> diff --git a/mm/vmstat.c b/mm/vmstat.c > >> index 7758486097f9..957680db41fa 100644 > >> --- a/mm/vmstat.c > >> +++ b/mm/vmstat.c > >> @@ -1650,6 +1650,11 @@ static void zoneinfo_show_print(struct seq_fi= le *m, pg_data_t *pgdat, > >> zone->spanned_pages, > >> zone->present_pages, > >> zone_managed_pages(zone)); > >> +#ifdef CONFIG_CMA > >> + seq_printf(m, > >> + "\n cma %lu", > >> + zone->cma_pages); > >> +#endif > >>=20 > >> seq_printf(m, > >> "\n protection: (%ld", > >=20 > > Hmm, not sure about this. If cma is only printed for CONFIG_CMA, we = can't=20 > > distinguish between (1) a kernel without your patch without including= some=20 > > version checking and (2) a kernel without CONFIG_CMA enabled. IOW,=20 > > "cma 0" carries value: we know immediately that we do not have any CM= A=20 > > pages on this zone, period. > >=20 > > /proc/zoneinfo is also not known for its conciseness so I think print= ing=20 > > "cma 0" even for !CONFIG_CMA is helpful :) > >=20 > > I think this #ifdef should be removed and it should call into a=20 > > zone_cma_pages(struct zone *zone) which returns 0UL if disabled. > >=20 >=20 > Yeah, that=E2=80=99s also what I proposed in a sub-thread here. >=20 Ah, I certainly think your original intuition was correct. > The last option would be going the full mile and not printing nr_free_c= ma. Code might get a bit uglier though, but we could also remove that sta= ts counter ;) >=20 > I don=E2=80=98t particularly care, while printing =E2=80=9E0=E2=80=9C m= ight be easier, removing nr_free_cma might be cleaner. >=20 > But then, maybe there are tools that expect that value to be around on = any kernel? >=20 Yeah, that's probably undue risk, the ship has sailed and there's no=20 significant upside. I still think "cma 0" in /proc/zoneinfo carries value, though, especially= =20 for NUMA and it looks like this is how it's done in linux-next. With a=20 single read of the file, userspace can make the determination what CMA=20 pages exist on this node. In general, I think the rule-of-thumb is that the fewer ifdefs in=20 /proc/zoneinfo, the easier it is for userspace to parse it. (I made that change to /proc/zoneinfo to even print non-existant zones fo= r=20 each node because otherwise you cannot determine what the indices of=20 things like vm.lowmem_reserve_ratio represent.) --1482994552-507496633-1611872904=:323143--