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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 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 3B267CA9EC7 for ; Sat, 2 Nov 2019 13:57:22 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F33D020862 for ; Sat, 2 Nov 2019 13:57:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F33D020862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=osku.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1iQtte-0005HW-OD; Sat, 02 Nov 2019 09:56:54 -0400 Received: from mout.kundenserver.de ([212.227.17.13]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1iQttc-0005HO-16 for kernelnewbies@kernelnewbies.org; Sat, 02 Nov 2019 09:56:52 -0400 Received: from ALDOS ([88.68.133.182]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MILru-1iCeop2tcq-00ELIe; Sat, 02 Nov 2019 14:56:43 +0100 Date: Sat, 2 Nov 2019 14:56:36 +0100 From: Andre Schmidt To: Greg KH Subject: Re: Simple system stats. Message-ID: <20191102145636.60fa2891@ALDOS> In-Reply-To: <20191102131308.GA391073@kroah.com> References: <20191102125105.0b403a3b@ALDOS> <20191102120700.GA297440@kroah.com> <20191102140519.1ebcb664@ALDOS> <20191102131308.GA391073@kroah.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Provags-ID: V03:K1:ruQgMhjSWYpuBOASXyqRHXwPL3Bk7ivu+JEdL+mJ+8+dJe0N2DU 9HYnjx2pZlW23UH7ZqdS4Camr93t7fYa7oGWeTjQqJzgP4I1LfIr6kcceDziHEvc3wAIWMr O9NOIjsoc/GJpczxiQxWL6LJrlu4pK8qpUU59ibZ/Zec1eEVAGJo/ehiu+Sx9hnoyzBR9m+ 3VZhvDK4r9MBI6mB9AadQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:BE8DAEThjcE=:phcjP/o3Gs8W8nLGc5CYzo 9ptpkHJ8YpUv67pOdlGVkxXeNlRSONhSrgpHEVB1zqRMKTE0Q9MGm4SN27kgBpLW34BcbdkrB 6bFAUw3gVdJ+vvKC2LXmJoRxRVH9e6X1TYo7fiX9pWVKIjw49qWhJs9U76iGR4kluEmNF5TNZ uHxRTHkj6GkTuXi29s3aQiyvTg8ZhlxNOFNRtWqR1ptJnF4OrUTPEOuO6wpZyD5S3/x9A59Nf CocNyPGmLiYrWQfmy8NjHNB0TUw5O8SArWxVbx6VXQ+5Kk/zjikCxB1uI+34Xni8szDxdIT91 XBIrrkaobNeEdPXFaL0/1U6gnObhjidaOkUAyd+nTz9h7FGF8UEfDOLVWDV5VoFThz8mqd7Bj f1uJYr1Ep10kuMTPAyKNlcGvLI5Sng9PcECmKoGfned3L8pbt8Cdv8OjAmUtY1yogPFHTpmrE FTqayMXZLl41XIzPf1HSsU5xGyZD4Ki2fqw9kS91LBwZ/xM5q5pvarbbKLlQ5aMNSI7RnoTrE A+tI+6wWGi7vqWZL9mW3g01Wll13MGXjuKGq/zmd6uOCRLbmAtsdKXCKD3M1jYHmnNYKddV97 OgkRlg/Lw34Vzf3AAH+csSbIka0dPvvXFXRjZW79uXiV/ZR1G3RkGOZ7z9BE9GHUwunYwdPmh TCt+VAmQKd7q0HltQShVzEX1qjtcX+nzGTR5URBCl+Wp+KxbCPYwbCbPMz1IJKT8C3VQz8Rou R+7NjHGr73tRAQ5bKGUMyWJlJOtxaqggNxQfkXeb5p/P2VN2TsFqjJqCuOdlPGZY9KqSLmNui EpiiCjkPhKmm78v3rz3v/eIqezUCQfyhkfvVMrv5SuTudOjw/fiyuLigsbzvZAzEWzQwYoiGT ATXsaZ6T7UZi6hIdcpXg== Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Sat, 2 Nov 2019 14:13:08 +0100 Greg KH wrote: > On Sat, Nov 02, 2019 at 02:05:19PM +0100, Andre Schmidt wrote: > > On Sat, 2 Nov 2019 13:07:00 +0100 > > Greg KH wrote: > > > > > On Sat, Nov 02, 2019 at 12:51:05PM +0100, Andre Schmidt wrote: > > > > Hello kernel space, > > > > > > > > user space webmonkey here, tinkering on my home desktop setup and spelunking way too many rabbit holes... damn you source code! ;P > > > > > > > > The other day i got frustrated with re-implementing parsing and calculation of /proc/stat and /proc/meminfo for my visual user interface experiments (in various languages), so i "created"* a kernel module that helps me with that (https://github.com/oskude/proc_topstat). > > > > > > > > But i could not get swap info in the kernel module, cause - i guess - it's not exported? > > > > So i wonder, would/could upstream EXPORT_SYMBOL(si_swapinfo)? > > > > If yes/maybe, where/how should i propose such change? > > > > > > Symbols and functions are only exported if an in-kernel-tree module > > > needs it. Sorry. > > > > > > What's wrong with parsing the existing exports of this value as-is? > > > > do you mean i can get swap usage info in a kernel module without si_swapinfo? > > Not that I know of, no. > > > (as seen here https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/proc/meminfo.c#n44) > > > > or do you mean what is wrong with /proc/meminfo? > > Yes, what is wrong with that? I guess there's nothing "wrong" with /proc/meminfo (or /proc/stat), i just want to display their - for me/user relevant - data every 250ms and parsing them felt so sub-optimal... So i just removed what i didn't need and pre-calculated what i could, in the kernel module. So i would not need to worry about it again (except, yeah, when upstream changes). Also, as i dabble in various programming languages (in userspace), i would need to re-implement the parsing and calculation (that matters to me/user) of /proc/stat and /proc/meminfo every time... (but i guess that is userspace work? translate kernelspace data to userspace data? does "user" even mean "human"?;P) But whatever, i now like this more: $> cat /proc/topstat cpu 2085949 109734 cpu 2086513 108671 cpu 2086203 110817 cpu 2086167 127600 mem 8026148 2993832 1033648 cpu - line number implies cpu number. - jiffies elapsed. - amount of in use by programs, that cannot be used by other programs. mem - kilobytes of memory. - amount of in use by programs, that can not be used by other programs. - amount of in use for caches, that can be freed by user. For now, i can live without swap ui, i avoid swap anyway :D Cheers Andre Schmidt _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies