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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 C7D15C433E9 for ; Fri, 5 Feb 2021 21:52:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B5A564FCA for ; Fri, 5 Feb 2021 21:52:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B5A564FCA 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 ABD326B0006; Fri, 5 Feb 2021 16:52:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A6D0D6B006C; Fri, 5 Feb 2021 16:52:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 983EA6B006E; Fri, 5 Feb 2021 16:52:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 7F6196B0006 for ; Fri, 5 Feb 2021 16:52:14 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 41B64181AEF15 for ; Fri, 5 Feb 2021 21:52:14 +0000 (UTC) X-FDA: 77785562988.08.oil50_2f155e8275e8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 23C7F1819E76B for ; Fri, 5 Feb 2021 21:52:14 +0000 (UTC) X-HE-Tag: oil50_2f155e8275e8 X-Filterd-Recvd-Size: 7891 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 21:52:13 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id c12so9296592wrc.7 for ; Fri, 05 Feb 2021 13:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/G/5th0PpgWzaHlGN8L+2GW8U9A9V9verMJjNjsxBWg=; b=Na+AIqk4zgAKp7eMiaDOjKP1QLeOQf/3wbhYQDHWywMtihMnEhxlLoXWwPWnN5BPSU g4FZbyfgADNpUaOfFDxN545b7zqXc1jX5Jn1pHYeCJWOyB3P8V1ixZwR5I+lF5RkOyYa HbBqoPCZZXeRKzNhcl91wntoBCJhWCk5Fs8MWdy0hyPNFAfJY+fL89r75lX0CKYAvKZ6 XExlaVLbjcDjdCCwiqzK6zr0xkRhoDSxMUlQU80kRn8dzjSH64HJNB1uUDqEq8KTU5gL 4jdnEmpjiseOXDx4bQs4a+m2tRAI28du6NthQ3Sl44lcxLjWOvzz0JPTsfwsbPDaiqEL mwxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/G/5th0PpgWzaHlGN8L+2GW8U9A9V9verMJjNjsxBWg=; b=C8/XUp1cIhGzku067BnjBNPLVMc6qCfGnPiJOkFMp6rP+4MpMxMNM8al8zJh2/mGK6 +Pd6aIAwqR8/vkmO3tZb8xogiE/N65nlBDDJ+iTtsdLNBT70N80YGiXSRIh3zusKtqpY ddDf/QPQDJHTX0yDHLZlybGFUrMrRbm5vNVkwGIcIERQWMeUSKHBwOWOO+QxWUz5K/6t NCXwsaeKkOK1+1KVgZaa2rJyvBSSF7uNL47jJnTDWduzrinv4YTclewExEdXUoJFEgzl OkeXswN+WKyI6JGvc3ZuEoc80I69PWnVT2Em98wDUnugDiyuNejsvr8a3eNcv6qD7pak 1lqQ== X-Gm-Message-State: AOAM532OD+uwtkH1sErhfYJC7/yjuQ+Oq4XyPWQpCPNwcuO+C9VSRa6d 376H/OlM36C4wBHNgpgM4G8ZCQVHgi98h43yIk6nng== X-Google-Smtp-Source: ABdhPJzAUrSB5pmFT2HMQwGkonhVcfHyiDFDsmWm48rqHDf7yujqAHfhiV7UEF6RReh2d95xZh8aizY5B2Hd7vJGqKA= X-Received: by 2002:adf:e50e:: with SMTP id j14mr7321998wrm.162.1612561932142; Fri, 05 Feb 2021 13:52:12 -0800 (PST) MIME-Version: 1.0 References: <87d7ec1f-d892-0491-a2de-3d0feecca647@nvidia.com> <71c4ce84-8be7-49e2-90bd-348762b320b4@nvidia.com> <34110c61-9826-4cbe-8cd4-76f5e7612dbd@nvidia.com> <269689b7-3b6d-55dc-9044-fbf2984089ab@nvidia.com> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 5 Feb 2021 13:52:00 -0800 Message-ID: Subject: Re: [PATCH] mm: cma: support sysfs To: Minchan Kim Cc: John Hubbard , Andrew Morton , Greg Kroah-Hartman , John Dias , LKML , linux-mm Content-Type: text/plain; charset="UTF-8" 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 Fri, Feb 5, 2021 at 1:28 PM Minchan Kim wrote: > > On Fri, Feb 05, 2021 at 12:25:52PM -0800, John Hubbard wrote: > > On 2/5/21 8:15 AM, Minchan Kim wrote: > > ... > > > > Yes, approximately. I was wondering if this would suffice at least as a baseline: > > > > > > > > cma_alloc_success 125 > > > > cma_alloc_failure 25 > > > > > > IMO, regardless of the my patch, it would be good to have such statistics > > > in that CMA was born to replace carved out memory with dynamic allocation > > > ideally for memory efficiency ideally so failure should regard critical > > > so admin could notice it how the system is hurt. > > > > Right. So CMA failures are useful for the admin to see, understood. > > > > > > > > Anyway, it's not enough for me and orthgonal with my goal. > > > > > > > OK. But...what *is* your goal, and why is this useless (that's what > > orthogonal really means here) for your goal? > > As I mentioned, the goal is to monitor the failure from each of CMA > since they have each own purpose. > > Let's have an example. > > System has 5 CMA area and each CMA is associated with each > user scenario. They have exclusive CMA area to avoid > fragmentation problem. > > CMA-1 depends on bluetooh > CMA-2 depends on WIFI > CMA-3 depends on sensor-A > CMA-4 depends on sensor-B > CMA-5 depends on sensor-C > > With this, we could catch which module was affected but with global failure, > I couldn't find who was affected. > > > > > Also, would you be willing to try out something simple first, > > such as providing indication that cma is active and it's overall success > > rate, like this: > > > > /proc/vmstat: > > > > cma_alloc_success 125 > > cma_alloc_failure 25 > > > > ...or is the only way to provide the more detailed items, complete with > > per-CMA details, in a non-debugfs location? > > > > > > > > > > > > ...and then, to see if more is needed, some questions: > > > > > > > > a) Do you know of an upper bound on how many cma areas there can be > > > > (I think Matthew also asked that)? > > > > > > There is no upper bound since it's configurable. > > > > > > > OK, thanks,so that pretty much rules out putting per-cma details into > > anything other than a directory or something like it. > > > > > > > > > > b) Is tracking the cma area really as valuable as other possibilities? We can put > > > > "a few" to "several" items here, so really want to get your very favorite bits of > > > > information in. If, for example, there can be *lots* of cma areas, then maybe tracking > > > > > > At this moment, allocation/failure for each CMA area since they have > > > particular own usecase, which makes me easy to keep which module will > > > be affected. I think it is very useful per-CMA statistics as minimum > > > code change so I want to enable it by default under CONFIG_CMA && CONFIG_SYSFS. > > > > > > > by a range of allocation sizes is better... > > > > > > I takes your suggestion something like this. > > > > > > [alloc_range] could be order or range by interval > > > > > > /sys/kernel/mm/cma/cma-A/[alloc_range]/success > > > /sys/kernel/mm/cma/cma-A/[alloc_range]/fail > > > .. > > > .. > > > /sys/kernel/mm/cma/cma-Z/[alloc_range]/success > > > /sys/kernel/mm/cma/cma-Z/[alloc_range]/fail The interface above seems to me the most useful actually, if by [alloc_range] you mean the different allocation orders. This would cover Minchan's per-CMA failure tracking and would also allow us to understand what kind of allocations are failing and therefore if the problem is caused by pinning/fragmentation or by over-utilization. > > > > Actually, I meant, "ranges instead of cma areas", like this: > > > > / > / > / > / > ... > > / > / > > > The idea is that knowing the allocation sizes that succeeded > > and failed is maybe even more interesting and useful than > > knowing the cma area that contains them. > > Understand your point but it would make hard to find who was > affected by the failure. That's why I suggested to have your > suggestion under additional config since per-cma metric with > simple sucess/failure are enough. > > > > > > > > > I agree it would be also useful but I'd like to enable it under > > > CONFIG_CMA_SYSFS_ALLOC_RANGE as separate patchset. > > > > > > > I will stop harassing you very soon, just want to bottom out on > > understanding the real goals first. :) > > > > I hope my example makes the goal more clear for you.