Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2287926pxb; Fri, 5 Feb 2021 13:58:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyYgOzUEUBskGo4spEed42O5Xg+IkJqDJfGdyqb2oizdTGv5r51yZJPS29kceRJd0Hx+ye X-Received: by 2002:a17:906:fca1:: with SMTP id qw1mr5597705ejb.130.1612562290636; Fri, 05 Feb 2021 13:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612562290; cv=none; d=google.com; s=arc-20160816; b=FJOeqhu/xp24RklWXl2yws76goFNv/LJopHh+pHJVH5qJm0x3RgSW+pt8mPEynt+Va pl7yBuChF2RCcO/MfMp1LjF0KchINbERQssLJ75HQRi6mNP8LTA1WVpTORpn5q87Ps75 B/FBgVK5KEPVmybE/574XLclkjEUDEHsTu8kYVYJeVCRW6fQ/YCdB9fXF7brrG4DKk7v scrP2Njp2E6I2cLPt0gj1Lgle+YzhQ7q2NC80rNJqEY0E5dSI4v8IjcTa6z3FH9vO5Gi xLACO2/qzbDxQmQfIvnGagJbv5URuayf2S3PldVWUaen4Gs+owj9Mf1df2TJ+t810uJA rrJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/G/5th0PpgWzaHlGN8L+2GW8U9A9V9verMJjNjsxBWg=; b=ZsvA6Erncx8o3vsYSAPEK2ACPpssKDYCkoFTwh3ZW6nwQLoXqbmnCFndYWWt6vkN5e o7wYFtQhPqxr2jln7Bnq/wdNi8NxjyVnXwfJl7YeXpvI+1wMPegIlL3RoEof6buH82Jz 5qK/UGmceLrbIutA8odwlPX4BmeBovXOnCtW/YEBNRz9JWzE6+9I8prRXfTJ2M3oI5Cy lQSMHB4I7xv/7r9RgsWvRHFWc9DRAPQSPWDfUd7Fm0jCSkTEbTI5e2VDlQg0zVVoFWfp mQljdgAbl9knUymNIQcRn7UW5qDeqZtB/O1sfq2VdoAYwgg6Yh8Eqp90UFNV52Ahuy6u Lf8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Na+AIqk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si6622377edc.230.2021.02.05.13.57.44; Fri, 05 Feb 2021 13:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Na+AIqk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbhBEVxl (ORCPT + 99 others); Fri, 5 Feb 2021 16:53:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhBEVwy (ORCPT ); Fri, 5 Feb 2021 16:52:54 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B73C061786 for ; Fri, 5 Feb 2021 13:52:13 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id z6so9267054wrq.10 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=SB02jvTCu1e6OVGo0GPqDWkfKgij/4WQihsxtQcqpjnLHTl+IVnejMxkgPQWgr3Mb7 URpqabtbDL6+yLATYvQpHGwBfLjtANWOhPqlO9mQp9uKE1jl7P3K8PawSo8H4NPRgQxh dXDgX6JWcDsSPhXrU+ZaQ/wGeYzzhkAtgh2puk1TzxzHc4XOeumlYYEbDpwZIgzvEQ+c L0fNL4FfvCl+vXiYdiJxL/7JOKVuWXDp9XJzAU2ZSkCb+pD7tq3bOH0JU0swEc0KSSff xQtQhqht95fFd6mkPeykPJzjnNX0L3pcPQxgNiOSKz9cZtWLUG/Omwp03aa1EKEAbzsb BXIg== X-Gm-Message-State: AOAM531QMhKrfiIaJjYFw0t0IwTpN3x72sBAFuwPfo9IQsDx6Xdp2zDo pmuCBZY1i/QZ8sekhgNIZR9RrzKveLjxr8uYh5ArXw== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.