Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp399085ybh; Wed, 18 Mar 2020 01:59:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuXMjcL5eW7zeXoj90yRw+r6hRFg4kzCq+u+J4re99fNnso8jy6rIZjXcsNdEYcezO+PbEE X-Received: by 2002:aca:ec16:: with SMTP id k22mr2364132oih.177.1584521992408; Wed, 18 Mar 2020 01:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584521992; cv=none; d=google.com; s=arc-20160816; b=bJn9OsBT20UkOZyaLDys0teA/3OHgEdZNmxjEr5RPBtMDwhOI53cNlWvMF1YMm830K iFcPwwKcpbJCbjXWeI/FtQSvHcxpGzQQJKh/xx2pDkMNh6O6Nbh5JhHJiPgvIof97TSH nT5E7zuWCWswv1727Dwn86XgfYWV0UXwz7K8CUPZ1AUaGMwHivg/nB2WwQHN43qySsDJ uRMkr8JvlkMUSoUYNr6i38ZKghBlRKxWIg77inQbDp5ipLqSxtrJ25qSYKiy+ExK+1D2 oO54NPSWz0HnOlWZSS0WLmevOu1ycTHE2P4G9AwCdbV5uY7qQyEyYecjLe8awnXBPwdi 0YCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=8hp0ir/q4A6JVzf2d3zvuRx34xSSf5M6YWyVyROQOYk=; b=qwxIH2v/TCHxcZIcAoXIcJhvv0zL9dFN4pzn+5Y70uLuIJE/QZ7dIefzHTPD7Hg7tc M9pCt89tpxcZycRyggZ4yaImtQH8EEQtf9ZG/jmZMVaNzTDoasB+15WW9S/t4rjESlEa pDPqDwl8Al8xeBU95PmwT80/uXZ8pQ9cUoU68pAY8cCYE/Fu+tIS1gfn/Nm8/pP1KOqa Ktj2R1YIqjZWRYlHEaLUIAvLfIgBOUnO7mhcIRjO6RdsTwcP+YXccSANTHUmVCmx0WNj J1f48JLeaYfOI1z6+z3A5JbFmWq9pPU9ukIyBCb/Z9xb4XshDIxy8ZkbByAOQVoXh9ia w1+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=e99U5fAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si3201347otn.291.2020.03.18.01.59.40; Wed, 18 Mar 2020 01:59:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=e99U5fAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726390AbgCRI7E (ORCPT + 99 others); Wed, 18 Mar 2020 04:59:04 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:40948 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbgCRI7E (ORCPT ); Wed, 18 Mar 2020 04:59:04 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20200318085900epoutp019b9ef564039138c753c7e095d0b31ac7~9Wk9kd-vC0621106211epoutp01q for ; Wed, 18 Mar 2020 08:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20200318085900epoutp019b9ef564039138c753c7e095d0b31ac7~9Wk9kd-vC0621106211epoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1584521940; bh=8hp0ir/q4A6JVzf2d3zvuRx34xSSf5M6YWyVyROQOYk=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=e99U5fAA3CsZykXbBQ0zAUnLWTmTrBvFcK1zthDuQp8iUEldLmM7+Q6GyDmzTCKNr 2N6MHkkf9KBs9XLxSfyFpKx03jmKflv2WNnoB0ZVexz4fqG4sRnd6prUIKq/AdQFKU dPKxJsfUcqsOMQ6M6VlvaBlhdOexZhRrnzPNVKC4= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20200318085900epcas1p49752c01f1811c2d185fd9c30270ec7a2~9Wk87rUeM1498014980epcas1p4k; Wed, 18 Mar 2020 08:59:00 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.40.164]) by epsnrtp1.localdomain (Postfix) with ESMTP id 48j3ql1tzlzMqYlt; Wed, 18 Mar 2020 08:58:59 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id E6.C3.04160.3D2E17E5; Wed, 18 Mar 2020 17:58:59 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20200318085858epcas1p444511493e8c9cc67e83ed82fc879ff36~9Wk7hRtNL0093600936epcas1p4t; Wed, 18 Mar 2020 08:58:58 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200318085858epsmtrp186bc86de093ebb1e7b47be6924a5d0e2~9Wk7fWXz90885308853epsmtrp1F; Wed, 18 Mar 2020 08:58:58 +0000 (GMT) X-AuditID: b6c32a38-297ff70000001040-31-5e71e2d39929 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A4.E0.04158.2D2E17E5; Wed, 18 Mar 2020 17:58:58 +0900 (KST) Received: from [10.253.104.82] (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200318085857epsmtip12aa87c451df1609921004458ce2715df~9Wk6hrdFV0789707897epsmtip1m; Wed, 18 Mar 2020 08:58:57 +0000 (GMT) Subject: Re: [RFC PATCH 0/3] meminfo: introduce extra meminfo To: Leon Romanovsky , Jaewon Kim Cc: Vlastimil Babka , adobriyan@gmail.com, Andrew Morton , Laura Abbott , Sumit Semwal , minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Linux API From: Jaewon Kim Message-ID: <5E71E2CB.4030704@samsung.com> Date: Wed, 18 Mar 2020 17:58:51 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20200317143715.GI3351@unreal> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDJsWRmVeSWpSXmKPExsWy7bCmnu7lR4VxBvNO8FhMb/SymLN+DZtF 9+aZjBYr9/xgspjyaymzxebvHWwWl3fNYbO4t+Y/q8Wyr+/ZLTa0zGK3eDRhEpPFqbuf2S1m N/YxOvB67Jx1l91j06pONo9Nnyaxe9y5tofN48SM3ywe7/ddZfM4s+AIu8fOT5tZPT5vkgvg jMqxyUhNTEktUkjNS85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAG6W0mh LDGnFCgUkFhcrKRvZ1OUX1qSqpCRX1xiq5RakJJTYGhQoFecmFtcmpeul5yfa2VoYGBkClSZ kJPx8rhhwQqDijVtM1gaGBvUuxg5OSQETCTmrvvK3MXIxSEksINR4nfDXFYI5xOjxOQv85kg nG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SNsMThw8UQNa8ZJd7smMcIUiMsYCvx8v8BZhBbRMBLYu+8w2wQRT3M Em/PTwRzmAXuMEksv/cZbCqbgLbE+wWTWEFsXgEtiWsvP4J1swioSsw40glmiwpESKxed40Z okZQ4uTMJywgNidQ755rd8A2MwuoS/yZd4kZwpaXaN46m3kCo+AsJC2zkJTNQlK2gJF5FaNk akFxbnpusWGBUV5quV5xYm5xaV66XnJ+7iZGcJxpae1gPHEi/hCjAAejEg9vwqaCOCHWxLLi ytxDjBIczEoivIsL8+OEeFMSK6tSi/Lji0pzUosPMUpzsCiJ88rnH4sUEkhPLEnNTk0tSC2C yTJxcEo1MCrl3UnbEfty9/vHetdmLV4t1mxRo97qEMLWfTJki7zllO/iM/0UI6SXXtOXOtTZ dvXKW++NOjccWVqdlt513Gey1GOlYnO+PhOnVZBSduYE3Qs3Yz5X3T+brio9z/BM5uXCu6vF 7vrLf6vtuVy7N/8a77ReibQ4N8dVr2qtNJf2/f52MaMhV4mlOCPRUIu5qDgRABY3izGvAgAA X-CMS-MailID: 20200318085858epcas1p444511493e8c9cc67e83ed82fc879ff36 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200311034454epcas1p2ef0c0081971dd82282583559398e58b2 References: <20200311034441.23243-1-jaewon31.kim@samsung.com> <20200313174827.GA67638@unreal> <5E6EFB6C.7050105@samsung.com> <20200316083154.GF8510@unreal> <20200317143715.GI3351@unreal> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020년 03월 17일 23:37, Leon Romanovsky wrote: > On Tue, Mar 17, 2020 at 12:04:46PM +0900, Jaewon Kim wrote: >> 2020년 3월 16일 (월) 오후 5:32, Leon Romanovsky 님이 작성: >>> On Mon, Mar 16, 2020 at 01:07:08PM +0900, Jaewon Kim wrote: >>>> >>>> On 2020년 03월 14일 02:48, Leon Romanovsky wrote: >>>>> On Fri, Mar 13, 2020 at 04:19:36PM +0100, Vlastimil Babka wrote: >>>>>> +CC linux-api, please include in future versions as well >>>>>> >>>>>> On 3/11/20 4:44 AM, Jaewon Kim wrote: >>>>>>> /proc/meminfo or show_free_areas does not show full system wide memory >>>>>>> usage status. There seems to be huge hidden memory especially on >>>>>>> embedded Android system. Because it usually have some HW IP which do not >>>>>>> have internal memory and use common DRAM memory. >>>>>>> >>>>>>> In Android system, most of those hidden memory seems to be vmalloc pages >>>>>>> , ion system heap memory, graphics memory, and memory for DRAM based >>>>>>> compressed swap storage. They may be shown in other node but it seems to >>>>>>> useful if /proc/meminfo shows all those extra memory information. And >>>>>>> show_mem also need to print the info in oom situation. >>>>>>> >>>>>>> Fortunately vmalloc pages is alread shown by commit 97105f0ab7b8 >>>>>>> ("mm: vmalloc: show number of vmalloc pages in /proc/meminfo"). Swap >>>>>>> memory using zsmalloc can be seen through vmstat by commit 91537fee0013 >>>>>>> ("mm: add NR_ZSMALLOC to vmstat") but not on /proc/meminfo. >>>>>>> >>>>>>> Memory usage of specific driver can be various so that showing the usage >>>>>>> through upstream meminfo.c is not easy. To print the extra memory usage >>>>>>> of a driver, introduce following APIs. Each driver needs to count as >>>>>>> atomic_long_t. >>>>>>> >>>>>>> int register_extra_meminfo(atomic_long_t *val, int shift, >>>>>>> const char *name); >>>>>>> int unregister_extra_meminfo(atomic_long_t *val); >>>>>>> >>>>>>> Currently register ION system heap allocator and zsmalloc pages. >>>>>>> Additionally tested on local graphics driver. >>>>>>> >>>>>>> i.e) cat /proc/meminfo | tail -3 >>>>>>> IonSystemHeap: 242620 kB >>>>>>> ZsPages: 203860 kB >>>>>>> GraphicDriver: 196576 kB >>>>>>> >>>>>>> i.e.) show_mem on oom >>>>>>> <6>[ 420.856428] Mem-Info: >>>>>>> <6>[ 420.856433] IonSystemHeap:32813kB ZsPages:44114kB GraphicDriver::13091kB >>>>>>> <6>[ 420.856450] active_anon:957205 inactive_anon:159383 isolated_anon:0 >>>>>> I like the idea and the dynamic nature of this, so that drivers not present >>>>>> wouldn't add lots of useless zeroes to the output. >>>>>> It also makes simpler the decisions of "what is important enough to need its own >>>>>> meminfo entry". >>>>>> >>>>>> The suggestion for hunting per-driver /sys files would only work if there was a >>>>>> common name to such files so once can find(1) them easily. >>>>>> It also doesn't work for the oom/failed alloc warning output. >>>>> Of course there is a need to have a stable name for such an output, this >>>>> is why driver/core should be responsible for that and not drivers authors. >>>>> >>>>> The use case which I had in mind slightly different than to look after OOM. >>>>> >>>>> I'm interested to optimize our drivers in their memory footprint to >>>>> allow better scale in SR-IOV mode where one device creates many separate >>>>> copies of itself. Those copies easily can take gigabytes of RAM due to >>>>> the need to optimize for high-performance networking. Sometimes the >>>>> amount of memory and not HW is actually limits the scale factor. >>>>> >>>>> So I would imagine this feature being used as an aid for the driver >>>>> developers and not for the runtime decisions. >>>>> >>>>> My 2-cents. >>>>> >>>>> Thanks >>>>> >>>>> >>>> Thank you for your comment. >>>> My idea, I think, may be able to help each driver developer to see their memory usage. >>>> But I'd like to see overall memory usage through the one node. >>> It is more than enough :). >>> >>>> Let me know if you have more comment. >>>> I am planning to move my logic to be shown on a new node, /proc/meminfo_extra at v2. >>> Can you please help me to understand how that file will look like once >>> many drivers will start to use this interface? Will I see multiple >>> lines? >>> >>> Something like: >>> driver1 .... >>> driver2 .... >>> driver3 .... >>> ... >>> driver1000 .... >>> >>> How can we extend it to support subsystems core code? >> I do not have a plan to support subsystem core. > Fair enough. > >> I just want the /proc/meminfo_extra to show size of alloc_pages APIs >> rather than slub size. It is to show hidden huge memory. >> I think most of drivers do not need to register its size to >> /proc/meminfo_extra because >> drivers usually use slub APIs and rather than alloc_pages APIs. >> /proc/slabinfo helps for slub size in detail. > The problem with this statement that the drivers that consuming memory > are the ones who are interested in this interface. I can be not accurate > here, but I think that all RDMA and major NICs will want to get this > information. > > On my machine, it is something like 6 devices. > >> As a candidate of /proc/meminfo_extra, I hope only few drivers using >> huge memory like over 100 MB got from alloc_pages APIs. >> >> As you say, if there is a static node on /sys for each driver, it may >> be used for all the drivers. >> I think sysfs class way may be better to show categorized sum size. >> But /proc/meminfo_extra can be another way to show those hidden huge memory. >> I mean your idea and my idea is not exclusive. > It is just better to have one interface. Sorry about that one interface. If we need to create a-meminfo_extra-like node on /sysfs, then I think further discussion with more people is needed. If there is no logical problem on creating /proc/meminfo_extra, I'd like to prepare v2 patch and get more comment on that v2 patch. Please help again for further discussion. Thank you > >> Thank you >>> Thanks >>> >>>> Thank you >>>> Jaewon Kim >