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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 CA54DC433DB for ; Fri, 5 Feb 2021 06:24:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0E01D64E4E for ; Fri, 5 Feb 2021 06:24:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E01D64E4E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4D8206B0005; Fri, 5 Feb 2021 01:24:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4888A6B006C; Fri, 5 Feb 2021 01:24:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 377546B006E; Fri, 5 Feb 2021 01:24:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 2145D6B0005 for ; Fri, 5 Feb 2021 01:24:20 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D27A0181AEF1F for ; Fri, 5 Feb 2021 06:24:19 +0000 (UTC) X-FDA: 77783224638.18.5740A0E Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf09.hostedemail.com (Postfix) with ESMTP id EB36D60001AB for ; Fri, 5 Feb 2021 06:24:18 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id b8so3029241plh.12 for ; Thu, 04 Feb 2021 22:24:19 -0800 (PST) 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=zSywmM2EpZ/Js/r/BYfFddDUaG1lx3gl3/zxV2qqNwo=; b=Vq/mL4ZsJ9A5DAOPn5VcUuTkCyUo+Z28wbu4s89OyvGU9Nn0IuWdgS0DQGflblnS/L 81LwbztUQ2TUPVs+mGhEDcRWou694qJDEiiNjMT6ktQQxGgQC7PHI7+vlvbWz+adyn2z 0M3HjQhxHSsDEe2D5FhP0EFkW2eVLEeuFhUPg2jktPoCk0s4TceaZvAe6eNpM+1p3iRz 21tnqumPbemMet5HvuMVkCaFqFgIh11qEIyBJ2rgszgDxO2DDbiW0QqH7ldakBjh9op1 DhIvHY44FYayHdUFRgHOQgM0vALvlhR6Jg7WKQpywE34V+p1PsBk9pWuXvFZqA7gtxd/ 0XXw== 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=zSywmM2EpZ/Js/r/BYfFddDUaG1lx3gl3/zxV2qqNwo=; b=tEYP0feK74YKO9O6hPnF5Sjah3zbPOKyIpgW7hsgaqo/7J4avIMjp7nGQrieRTgVTF tpGsyd1blbUEZZbkKpSfLuAXLHb9oyocD+0sLUQGZHz39o9X2Lr8E+fLOCmwISHcCHDk 8120n9TVBXT8xnXYNhJQ/Mkw/p4uSexcmNvx/z5CnPiVxu6Tn4YasFYVAbRzm6c2/318 BwCQuFdczPDznmFwMOauwHyEY/8qlguEYNd83kCpI9mBfk/c3H4bZsx0Md4/Cls1IzHN P/N3bAB8jMyave2TAzIzbauiXmv9wrHiK6gMSv29QGpPylwDlkvh1L9dzRp9U8hgPxyq 3nzg== X-Gm-Message-State: AOAM530X4QdYSlqlLGRhM3LWqewG8sr25+QhAtFuODQP4+Xagx4KpWVc M1RLsuFyWe0rb6tp25D+dro= X-Google-Smtp-Source: ABdhPJxiY5W5y7b2+v0yZLdqW1xZ4+/QfhHGMDUS8go/1xRrZT7q1lhyfy+xCeMkyJ1Otfq/4zBrog== X-Received: by 2002:a17:90b:1217:: with SMTP id gl23mr2701570pjb.163.1612506257993; Thu, 04 Feb 2021 22:24:17 -0800 (PST) Received: from google.com ([2620:15c:211:201:598:57c0:5d30:3614]) by smtp.gmail.com with ESMTPSA id r194sm7748905pfr.168.2021.02.04.22.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 22:24:16 -0800 (PST) Date: Thu, 4 Feb 2021 22:24:14 -0800 From: Minchan Kim To: John Hubbard Cc: Andrew Morton , gregkh@linuxfoundation.org, surenb@google.com, joaodias@google.com, LKML , linux-mm Subject: Re: [PATCH] mm: cma: support sysfs Message-ID: References: <20210203155001.4121868-1-minchan@kernel.org> <7e7c01a7-27fe-00a3-f67f-8bcf9ef3eae9@nvidia.com> <87d7ec1f-d892-0491-a2de-3d0feecca647@nvidia.com> <71c4ce84-8be7-49e2-90bd-348762b320b4@nvidia.com> <34110c61-9826-4cbe-8cd4-76f5e7612dbd@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34110c61-9826-4cbe-8cd4-76f5e7612dbd@nvidia.com> X-Stat-Signature: 3786akndnpfe6qutpxz7kdbb99cj76rc X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: EB36D60001AB Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mail-pl1-f177.google.com; client-ip=209.85.214.177 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1612506258-873585 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:49:54PM -0800, John Hubbard wrote: > On 2/4/21 9:17 PM, Minchan Kim wrote: > ... > > > > > Presumably, having the source code, you can easily deduce that a bluetooth > > > > > allocation failure goes directly to a CMA allocation failure, right? > > > > > > Still wondering about this... > > > > It would work if we have full source code and stack are not complicated for > > every usecases. Having said, having a good central place automatically > > popped up is also beneficial for not to add similar statistics for each > > call sites. > > > > Why do we have too many item in slab sysfs instead of creating each call > > site inventing on each own? > > > > I'm not sure I understand that question fully, but I don't think we need to > invent anything unique here. So far we've discussed debugfs, sysfs, and /proc, > none of which are new mechanisms. I thought you asked why we couldn't add those stat in their call site driver syfs instead of central place. Please clarify if I misunderstood your question. > > ... > > > > It's actually easier to monitor one or two simpler items than it is to monitor > > > a larger number of complicated items. And I get the impression that this is > > > sort of a top-level, production software indicator. > > > > Let me clarify one more time. > > > > What I'd like to get ultimately is per-CMA statistics instead of > > global vmstat for the usecase at this moment. Global vmstat > > could help the decision whether I should go deeper but it ends up > > needing per-CMA statistics. And I'd like to keep them in sysfs, > > not debugfs since it should be stable as a telemetric. > > > > What points do you disagree in this view? > > > No huge disagreements, I just want to get us down to the true essential elements > of what is required--and find a good home for the data. Initial debugging always > has excesses, and those should not end up in the more carefully vetted production > code. > > If I were doing this, I'd probably consider HugeTLB pages as an example to follow, > because they have a lot in common with CMA: it's another memory allocation pool, and > people also want to monitor it. > > HugeTLB pages and THP pages are monitored in /proc: > /proc/meminfo and /proc/vmstat: > > # cat meminfo |grep -i huge > AnonHugePages: 88064 kB > ShmemHugePages: 0 kB > FileHugePages: 0 kB > HugePages_Total: 500 > HugePages_Free: 500 > HugePages_Rsvd: 0 > HugePages_Surp: 0 > Hugepagesize: 2048 kB > Hugetlb: 1024000 kB > > # cat vmstat | grep -i huge > nr_shmem_hugepages 0 > nr_file_hugepages 0 > nr_anon_transparent_hugepages 43 > numa_huge_pte_updates 0 > > ...aha, so is CMA: > > # cat vmstat | grep -i cma > nr_free_cma 261718 > > # cat meminfo | grep -i cma > CmaTotal: 1048576 kB > CmaFree: 1046872 kB > > OK, given that CMA is already in those two locations, maybe we should put > this information in one or both of those, yes? Do you suggest something liks this, for example? cat vmstat | grep -i cma cma_a_success 125 cma_a_fail 25 cma_b_success 130 cma_b_fail 156 .. cma_f_fail xxx