Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3454628ybb; Mon, 23 Mar 2020 01:07:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvLbzS+hURzRhngCqvVf0YASumbbxrOnjj/yvl4oPfFDWEYjLDrupHszRWKqNX2dVQEcBX4 X-Received: by 2002:a05:6830:8d:: with SMTP id a13mr10163407oto.321.1584950837466; Mon, 23 Mar 2020 01:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584950837; cv=none; d=google.com; s=arc-20160816; b=KymPVeeVRjzSya3nk0AHrB1N4wpw6kO9wbY9HBg17eyDcj2De/SfDCMFSvAnggSUo3 de53EHSJoM+4/k4JHU08Jq8kOXgTq01g/deN4JAQKfSFq9ifzcAivXaaBArr1blQOWfB Ql+IDU7iN24sQp5TyDZTenofFr36WTGpeo8pvlyawdrpr8QeAusfZmbWih53aWv8HmCo x5yTZ8DWynUsxMstn4k/h+mZnNKu8WUyIa1SN6GsiA4I0pjBjNciUqwdvZJ16kU7tWF+ hPhfppXnhf8l8ZtzM0KNFeXGtgg8yNrkiAKkbLy6EB8RcBRB8S/TUUiWh1K4VIlPgyvY TPcA== 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:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=ykVbZIJ/4zPTvXN/17saU6Lgow62XEKLfWMfKVPs444=; b=X1sZQnBiaQvH4yPHgq+jm4rKKKf6vwqZFVxKrhrHs2oldqHFQVRPLhydZjAUZ3kP0B 833D+e+RSfjUW9oa3zL3Lieu0JFWsyZER1mrVMfiu2xlFV5Xn541eaxeCkwKJaeEZIPg KbCPdzou7gea6eyk0ZiAG86SG+0F2+Q/+Bpb3qrYOSozj2+R+uIB9/vM1VRp3QkitpwZ ppdvCrGlsMqgArZluueOxQKxQlbFK0sH5CFTzE6VTqufhgVpjyymwfUImnrIM+NmcraF rtYNzaDftoVisLP5eDq9uuj31HyQ7A5uC5+JHBvYJ7nKR5i9AiZ6JECHjOAczWTze3iu v8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PYxYnDuk; 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 a66si6808071otc.172.2020.03.23.01.07.04; Mon, 23 Mar 2020 01:07:17 -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=PYxYnDuk; 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 S1727558AbgCWIFU (ORCPT + 99 others); Mon, 23 Mar 2020 04:05:20 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:10993 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbgCWIFP (ORCPT ); Mon, 23 Mar 2020 04:05:15 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200323080511epoutp03f5227dd6dd1e0666fed121d20e49319e~_4EZiRpmY1284012840epoutp03s for ; Mon, 23 Mar 2020 08:05:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200323080511epoutp03f5227dd6dd1e0666fed121d20e49319e~_4EZiRpmY1284012840epoutp03s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1584950711; bh=ykVbZIJ/4zPTvXN/17saU6Lgow62XEKLfWMfKVPs444=; h=From:To:Cc:Subject:Date:References:From; b=PYxYnDukUE/mhxHhKmnRyMEUH6wWDLu+MSMbpfVyh9bVNG/2VUUE6BxiiYlv8+QBJ VCSjUsxSWs0y/f3Dl1MmJ2c/FiPWS/OpSN+iz5dUQ3tZkkeV8bgMcPI8t4SBVd7obB ApyqIbqjuL0nhuScbrvV4ovNGVZJ+4OvjHLqiLtE= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20200323080510epcas1p45d75c9ffd58750ec792de3c4e171ad9f~_4EYpd_oX1773617736epcas1p4u; Mon, 23 Mar 2020 08:05:10 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.163]) by epsnrtp4.localdomain (Postfix) with ESMTP id 48m6PJ4YhyzMqYkp; Mon, 23 Mar 2020 08:05:08 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id DB.49.04140.4BD687E5; Mon, 23 Mar 2020 17:05:08 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20200323080507epcas1p44cdb9ecb70a7a7395b3acddeda3cfd89~_4EV8G1Lz1502515025epcas1p47; Mon, 23 Mar 2020 08:05:07 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200323080507epsmtrp28c4b875b8eb660b709229a54f0557a32~_4EV7FeiX0358503585epsmtrp2z; Mon, 23 Mar 2020 08:05:07 +0000 (GMT) X-AuditID: b6c32a36-fa3ff7000000102c-29-5e786db4b76d Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 36.15.04158.3BD687E5; Mon, 23 Mar 2020 17:05:07 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200323080507epsmtip19cc9783e8c5f665b0e45a27cc3c34d3c~_4EVs_MxA0126101261epsmtip1M; Mon, 23 Mar 2020 08:05:07 +0000 (GMT) From: Jaewon Kim To: gregkh@linuxfoundation.org, leon@kernel.org, vbabka@suse.cz, adobriyan@gmail.com, akpm@linux-foundation.org, labbott@redhat.com, sumit.semwal@linaro.org, minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, kasong@redhat.com, bhe@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, linux-api@vger.kernel.org, kexec@lists.infradead.org, Jaewon Kim Subject: [RFC PATCH v2 0/3] meminfo_extra: introduce meminfo extra Date: Mon, 23 Mar 2020 17:05:00 +0900 Message-Id: <20200323080503.6224-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.13.7 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBJsWRmVeSWpSXmKPExsWy7bCmnu6W3Io4gy3tqhbTG70s5qxfw2Zx /sEvNovmxevZLLo3z2S06H3/isli+bvTjBa7T39lsli55weTxZRfS5ktNn/vYLO4vGsOm8W9 Nf9ZLZZ9fc9usaFlFrvFowmTmCxO3f3MbjG7sY/RQchj56y77B6bVnWyeWz6NInd4861PWwe J2b8ZvHYP3cNu8fmJfUe7/ddZfPo27KK0ePMgiPsHjs/bWb1+LxJLoAnKscmIzUxJbVIITUv OT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB+g9JYWyxJxSoFBAYnGxkr6d TVF+aUmqQkZ+cYmtUmpBSk6BoUGBXnFibnFpXrpecn6ulaGBgZEpUGVCTsbDTR1MBf/EKmad /cXYwHhZsIuRk0NCwERi2ultrF2MXBxCAjsY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YuQEistIvDn/ lAWiRlji8OFikLCQwFdGie5r1iA2m4C2xPsFk1hBbBGB+UwS/e38IHOYBTYzSkxc2swCkhAW cJL4vO8cWBGLgKrErHk97CA2r4CNxJWfdxgh5stLLPzPPIGRZwEjwypGydSC4tz03GLDAqO8 1HK94sTc4tK8dL3k/NxNjOCA19LawXjiRPwhRgEORiUe3hu95XFCrIllxZW5hxglOJiVRHg3 p1bECfGmJFZWpRblxxeV5qQWH2KU5mBREueVzz8WKSSQnliSmp2aWpBaBJNl4uCUamAsDvzz 8UTvZqeMrZ4zBdeZmb3Zuof/w5S3ExfcdNTlNuzs+L+N00Kcyfjw9uO+zG88me3E9jrPmRr0 XNh4ykFLoT3lttMk1j+ovmdmH6b65fgHiRtnDjDf8v/aud3koEl0lZJ7yfqdk/hCNnP+/pCz pdUtLEBtVpHi1JwdcWuFhe49PHXpB7OVEktxRqKhFnNRcSIAV4zkQHQCAAA= X-CMS-MailID: 20200323080507epcas1p44cdb9ecb70a7a7395b3acddeda3cfd89 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: 20200323080507epcas1p44cdb9ecb70a7a7395b3acddeda3cfd89 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org /proc/meminfo or show_free_areas does not show full system wide memory usage status because memory stats do not track all memory allocations. There seems to be huge hidden memory especially on embedded system. It is because some HW IPs in the system use common DRAM memory instead of internal memory. Device drivers directly request huge pages from the page allocator with alloc_pages. 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 be useful if /proc/meminfo_extra shows all those extra memory information. And show_mem also need to print the info in oom situation. Fortunately vmalloc pages is already 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_meminfo_extra(atomic_long_t *val, int shift, const char *name); int unregister_meminfo_extra(atomic_long_t *val); Currently register ION system heap allocator and zsmalloc pages. Additionally tested on local graphics driver. i.e) cat /proc/meminfo_extra | 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 --- v2: move to /proc/meminfo_extra, and use rcu v1: print info at /proc/meminfo On v1 patch, there was not resolved discussion about the logic. There seems to be agreement on showing memory usage, but there was a lack of consensus on way of showing the information. Other opinion is using /sys/ as separate file for each driver. --- Jaewon Kim (3): meminfo_extra: introduce meminfo extra mm: zsmalloc: include zs page size in meminfo extra android: ion: include system heap size in meminfo extra drivers/staging/android/ion/ion.c | 2 + drivers/staging/android/ion/ion.h | 1 + drivers/staging/android/ion/ion_system_heap.c | 2 + fs/proc/Makefile | 1 + fs/proc/meminfo_extra.c | 123 ++++++++++++++++++++++++++ include/linux/mm.h | 4 + mm/page_alloc.c | 1 + mm/zsmalloc.c | 2 + 8 files changed, 136 insertions(+) create mode 100644 fs/proc/meminfo_extra.c -- 2.13.7