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=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, 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 C89F5C433DB for ; Sat, 6 Feb 2021 17:08:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46A9964E81 for ; Sat, 6 Feb 2021 17:08:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46A9964E81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 91BD56B0005; Sat, 6 Feb 2021 12:08:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D16B6B006C; Sat, 6 Feb 2021 12:08:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 795286B006E; Sat, 6 Feb 2021 12:08:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 64A346B0005 for ; Sat, 6 Feb 2021 12:08:23 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 258213636 for ; Sat, 6 Feb 2021 17:08:23 +0000 (UTC) X-FDA: 77788476486.26.shake96_540b0b6275ef Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 03F751804B668 for ; Sat, 6 Feb 2021 17:08:22 +0000 (UTC) X-HE-Tag: shake96_540b0b6275ef X-Filterd-Recvd-Size: 7030 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Sat, 6 Feb 2021 17:08:22 +0000 (UTC) Received: by mail-ed1-f48.google.com with SMTP id g10so13220525eds.2 for ; Sat, 06 Feb 2021 09:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AgKjvYfEh6xpmyvNQMjRGgDLZsYQaTS+BFtps2bpJUw=; b=ThVvBbpSCDok5f64vDhprvEkK/m7fVXQdQpbbP4n/lz6Ig8IxNYWkLGoMyA37vrYzz gPs+IShTZe52N+faFtQ1JODauvpGwgLxImTmv7yg79QuBNu7LEtLrHE0LdCfKbHwT3J0 +momjgdxgVTTZRK6q5rJPgcQMe2nHVExdw8vz6Z9byh6fN7vSjfoWolc1hJgZPSZLJBZ 2Y7imnARDqana7qDnNwhqC6MfQk+BkwgtXmnjVXL2A+TvvTnsaAyWef61da89hmnchIA obdnq5A/aZfXYGOtNKGsl4P7NrQuybdVlNyM9x8IeWcFtSbzSAi3pRJv6X2540ZNiKNS n4lg== 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=AgKjvYfEh6xpmyvNQMjRGgDLZsYQaTS+BFtps2bpJUw=; b=kOKMRWLmndPTxuloESaV4F/ghI+zDwSYgbjlyej99ZXM1aMvQaoLcWy5Gsb6yj1/29 KDAIb0q0bN9cEmVUPDTiO7+7ZE97NU6hMBJErUXt6KkkdjBNqud0262XYTTDleTiFhsI dZG9SyYTXA7X1Jcoakbc83L/CK55skC53GhJxVjUG5XMjNPg5MFR80YxCdELwmRwBcdB gPlKMZ8s5EqwtYTCpOQ2fNb/dLAXQJUOtgrUEIGzJfTEHI8Fkct3NZ6ki0Bm52UDaW7f 6YcTK/xIoezCbjdTi9hAlkujGTx9Hn+vJnUKlcHXsfWOt3F+WR8mTqS8phv8C3RBGKbQ 9TlQ== X-Gm-Message-State: AOAM5312GW7dvO/75B+QqecVG00zBdYjT+2b15MMXCFfnsUtt3B5IImi xY1w2A3hrIwciIRNW43qMcmpZXDkzj9kv9RS6Zs= X-Google-Smtp-Source: ABdhPJx0FddPlepxSBE7r2noeRP3IBv5OhdVLMHl6lYWFCnitUzUkWX3j9z2mKYXmvrBBG7zi8nCjO91Lavw54JADQQ= X-Received: by 2002:a05:6402:2053:: with SMTP id bc19mr8966375edb.230.1612631301186; Sat, 06 Feb 2021 09:08:21 -0800 (PST) MIME-Version: 1.0 References: <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: Pintu Agarwal Date: Sat, 6 Feb 2021 22:38:09 +0530 Message-ID: Subject: Re: [PATCH] mm: cma: support sysfs To: Minchan Kim Cc: John Hubbard , Suren Baghdasaryan , 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 Sat, 6 Feb 2021 at 04:17, Minchan Kim wrote: > > On Fri, Feb 05, 2021 at 01:58:06PM -0800, John Hubbard wrote: > > On 2/5/21 1:52 PM, Suren Baghdasaryan wrote: > > > > > > 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. > > > > > > > I agree. That seems about right, now that we've established that > > cma areas are a must-have. > > Okay, now we agreed the dirction right now so let me do that in next > version. If you don't see it's reasonable, let me know. > > * I will drop the number of CMA *page* allocation attemtps/failures to > make simple start > * I will keep CMA allocation attemtps/failures > * They will be under /sys/kernel/mm/cma/cma-XX/success,fail > * It will turn on CONFIG_CMA && CONFIG_SYSFS > > Orthognal work(diffrent patchset) > > * adding global CMA alloc/fail into vmstat > * adding alloc_range success/failure under CONFIG_CMA_ALLOC_TRACKING > whatever configuration or just by default if everyone agree > > # cat meminfo | grep -i cma > CmaTotal: 1048576 kB > CmaFree: 1046872 kB This CMA info was added by me way back in 2014. At that time I even thought about adding this cma alloc/fail counter in vmstat. That time I also had an internal patch about it but later dropped (never released to mainline). If required I can re-work again on this part. And I have few more points to add here. 1) In the past I have faced this cma allocation failure (which could be common in small embedded devices). Earlier it was even difficult to figure if cma failure actually happened. Thus I added this simple patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.11-rc6&id=5984af1082f3b115082178ed88c47033d43b924d 2) IMO just reporting CMA alloc/fail may not be enough (at times). The main point is for which client/dev is this failure happening ? Sometimes just tuning the size or fixing the alignment can resolve the failure if we know the client. For global CMA it will be just NULL (dev). 3) IMO having 2 options SYSFS and DEBUGFS may confuse the developer/user (personal experience). So are we going to remove the DEBUGFS or merge it ? 4) Sometimes CMA (or DMA) allocation failure can happen even very early in boot time itself. At that time these are anyways not useful. Some system may not proceed if CMA/DMA allocation is failing (again personal experience). ==> Anyways this is altogether is different case... 5) The default max CMA areas are defined to be 7 but user can configure it to any number, may be 20 or 50 (???) 6) Thus I would like to propose another thing here. Just like we have /proc/vmallocinfo, /proc/slabinfo, etc., we can also have: /proc/cmainfo Here in /proc/cmaminfo we can capute more detailed information: Global CMA Data: Alloc/Free Client specific data: name, size, success, fail, flags, align, etc (just a random example). ==> This can dynamically grow as large as possible ==> It can also be enabled/disabled based on CMA config itself (no additional config required) Any feedback on point (6) specifically ? Thanks, Pintu