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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,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 2EE05C433E0 for ; Fri, 5 Mar 2021 20:34:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A11D364F60 for ; Fri, 5 Mar 2021 20:34:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A11D364F60 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 13F986B005D; Fri, 5 Mar 2021 15:34:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F1B76B006C; Fri, 5 Mar 2021 15:34:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAB7C6B006E; Fri, 5 Mar 2021 15:34:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id CCFC66B005D for ; Fri, 5 Mar 2021 15:34:10 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8D2685DE0 for ; Fri, 5 Mar 2021 20:34:10 +0000 (UTC) X-FDA: 77886972660.22.A2EC83D Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf30.hostedemail.com (Postfix) with ESMTP id 06B50E0011D2 for ; Fri, 5 Mar 2021 20:34:06 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id i14so2550768pjz.4 for ; Fri, 05 Mar 2021 12:34:09 -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=tN8qZ+KWThYmH9E3VZapMbdXrEuUHZuLx5+p/96sDQg=; b=u3sxopforp6nw7U1k71RKhMi0jxPGCBXVbNAe1a/hMx/5YqRKbKVsWXWszD5V6AYVT 4j9lsvSkRH4/KvULFVzmACUXig3MsgZgusLEI1xU0dFKGuG32i2z9QSlsCeYA8VkkMN+ OT5n4d4R6/3qkXiitnJajvF4l0P7Z6MkvpNQ0C2oDUXLHGf4ItLgAQfg8R9zfFOGDTBs hME9KO0segjMFQyORi97xzjFdBZlULp0hb9VmEGvYUIfV6lnmmiOLfAe0WhFTyl2IJiS GGRyj/w+TcpN6HSbtD0Poob1uiC9pzCdl7PuYbHy9RNSqkr9B6Gs60GVghRkqwAbZruE 9I9w== 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=tN8qZ+KWThYmH9E3VZapMbdXrEuUHZuLx5+p/96sDQg=; b=foWBOxDD8/9bkCLVuxqDXS79W4tFwf5UH8YzR32F/PuqaS+faY2APShXarvxGGIpwN eLU97u+ooKOEcelR6CnQKXuRIw8Y3HXjNyuMQz3ENs3SgW5hqIzJRMnvxectSwJxg7mP gJg/tX10VkmJPY3m7B2Flq3oRySnCQOugNocP+xTchZY9NBksMTIR53ZqnvEvGC4SviW Y7uTARqKnSpnO6PhvoS0MWNx2GPeNHUeJfWeH8FDohLJxOmFZH+kILmNqMCmpUlYKXlg ZhsRejNkvVhBUW0vAbgcCdCHAG1MAsNAnPauwmEXrt4DQ7DBiQD9S1XlYeP/pKwCEkSE EgvA== X-Gm-Message-State: AOAM531JYHebf02IGZz3Giu5M33YG0L1+vELdK7rZnP7o2PkWXcb0kTv 82c3Y75+pqSgEmG+2HkFBK6s6Rog6Tw= X-Google-Smtp-Source: ABdhPJw2klNUgWRvAsdtpsMkpBeP9d0568Xu37yKp9QSgKykh5ObcVpTT4CKNcDEKpsNNxLybuemPQ== X-Received: by 2002:a17:903:304e:b029:e5:d43:9415 with SMTP id u14-20020a170903304eb02900e50d439415mr10315907pla.42.1614976447900; Fri, 05 Mar 2021 12:34:07 -0800 (PST) Received: from google.com ([2620:15c:211:201:9db6:fc32:1046:dd86]) by smtp.gmail.com with ESMTPSA id e65sm942325pfe.9.2021.03.05.12.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 12:34:06 -0800 (PST) Date: Fri, 5 Mar 2021 12:34:05 -0800 From: Minchan Kim To: David Hildenbrand Cc: Andrew Morton , linux-mm , LKML , gregkh@linuxfoundation.org, surenb@google.com, joaodias@google.com, jhubbard@nvidia.com, willy@infradead.org Subject: Re: [PATCH v4] mm: cma: support sysfs Message-ID: References: <20210304161704.3056806-1-minchan@kernel.org> <98637abc-3b64-5bbc-f270-55619e12dccd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98637abc-3b64-5bbc-f270-55619e12dccd@redhat.com> X-Stat-Signature: dwd6m16zibutwziz56wiyjumm6r3sm5e X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 06B50E0011D2 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mail-pj1-f50.google.com; client-ip=209.85.216.50 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614976446-442199 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, Mar 05, 2021 at 06:34:22PM +0100, David Hildenbrand wrote: > On 04.03.21 17:17, Minchan Kim wrote: > > Since CMA is getting used more widely, it's more important to > > keep monitoring CMA statistics for system health since it's > > directly related to user experience. > > > > This patch introduces sysfs statistics for CMA, in order to provide > > some basic monitoring of the CMA allocator. > > > > * the number of CMA page allocation attempts > > * the number of CMA page allocation failures > > > > These two values allow the user to calcuate the allocation > > failure rate for each CMA area. > > > > e.g.) > > /sys/kernel/mm/cma/WIFI/cma_alloc_pages_[attempts|fails] > > /sys/kernel/mm/cma/SENSOR/cma_alloc_pages_[attempts|fails] > > /sys/kernel/mm/cma/BLUETOOTH/cma_alloc_pages_[attempts|fails] > > > > The cma_stat was intentionally allocated by dynamic allocation > > to harmonize with kobject lifetime management. > > https://lore.kernel.org/linux-mm/YCOAmXqt6dZkCQYs@kroah.com/ > > > > Reviewed-by: Greg Kroah-Hartman > > Reviewed-by: John Hubbard > > Signed-off-by: Minchan Kim > > --- > > From v3 - https://lore.kernel.org/linux-mm/20210303205053.2906924-1-minchan@kernel.org/ > > * kmalloc_array - akpm > > * add why cma_stat was implemented by dynamic allocation - akpm > > * use !__GFP_NOWARN facility to print error - akpm > > > > From v2 - https://lore.kernel.org/linux-mm/20210208180142.2765456-1-minchan@kernel.org/ > > * sysfs doc and description modification - jhubbard > > > > From v1 - https://lore.kernel.org/linux-mm/20210203155001.4121868-1-minchan@kernel.org/ > > * fix sysfs build and refactoring - willy > > * rename and drop some attributes - jhubbard > > > > Documentation/ABI/testing/sysfs-kernel-mm-cma | 25 ++++ > > mm/Kconfig | 7 ++ > > mm/Makefile | 1 + > > mm/cma.c | 6 +- > > mm/cma.h | 18 +++ > > mm/cma_sysfs.c | 110 ++++++++++++++++++ > > 6 files changed, 166 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/ABI/testing/sysfs-kernel-mm-cma > > create mode 100644 mm/cma_sysfs.c > > > > diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-cma b/Documentation/ABI/testing/sysfs-kernel-mm-cma > > new file mode 100644 > > index 000000000000..f518af819cee > > --- /dev/null > > +++ b/Documentation/ABI/testing/sysfs-kernel-mm-cma > > @@ -0,0 +1,25 @@ > > +What: /sys/kernel/mm/cma/ > > +Date: Feb 2021 > > +Contact: Minchan Kim > > +Description: > > + /sys/kernel/mm/cma/ contains a subdirectory for each CMA > > + heap name (also sometimes called CMA areas). > > + > > + Each CMA heap subdirectory (that is, each > > + /sys/kernel/mm/cma/ directory) contains the > > + following items: > > + > > + cma_alloc_pages_attempts > > + cma_alloc_pages_fails > > Nit: why "cma_" again when we are already under "/cma/" ? Originally, there was desire to add cma_alloc_attempts as well as cma_alloc_pages_attempts. > > I'd simply go with something like > > "total_alloc_attempts" > "failed_alloc_attempts" If we really want to remove the cma prefix, maybe, alloc_pages_attempts alloc_pages_fails If someone want to count cma_alloc itself, Then alloc_success alloc_fail Does that make sense?