Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4388705pxa; Mon, 10 Aug 2020 08:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztcd1EdzY29GkGNs1DCL27TmZwtvDqC7TXLp40ycYomt24OZIhXe8EEq/IzhqGtraX1vs/ X-Received: by 2002:a17:907:444c:: with SMTP id on20mr23142269ejb.77.1597071726468; Mon, 10 Aug 2020 08:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597071726; cv=none; d=google.com; s=arc-20160816; b=cFDfMOothqzc+Yz2q8KVwrojhlfZKCXQQFA3bb8JcEf0AZRkT5b8vRNyDJqTV9p83U JDUbznnbXiKfjD4kANg3fig1u6isfgm2LtSK8OWqJDvY3WyM9tB5BkjJRhv0ydhYOLAQ esZVouhoPH8ZhuGj/LWv8zJ2We74lSxNjdUQVmRNzlEeJdqfZO9AFxzQxD3CLtRmBhvb QuSAHpjN5KsCZdya/TEltIvndGezC3BJ1cLgN1Ygho94RMjmaeMMlzU8c75HvUmOa2AF 8ptnqtWEH0EtQCpFxw2dVcc5+EnnWQcwLEkXo+2sy6HvGIBA5Qt9EIZMOOWvvoZuAbJ/ bqpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3EOXOOWYYlAj99G6WV2By0kWl8SEe77hw4rKVyQwu0k=; b=sQIkAdkXHhU5dt+gOA46S1FHvaL7tXu0fkftFjq2n7RlZcQZo2wpu4OEUJZ5vvPMp7 L0dVvjyZJQTCleR8w6NYke0j/n2lktzYKZOtUYharAq7ENtN/dGfdOvm7XPgduaaASjW gDFtnEGEvehdm5qa/PlgtRq4ytX7VdldyiubcKiAh8VOPAqLQs61gXZNZUYBSkzL33bf KiyEmIew5tKTk1qkFrOii0FGW4pY/4yWwfh9osqWwXup6K5911wSR0YpMY//RRO2MpJX OYTUNXtIljXAIvoLHrO1FmGvOtbQfIWy4EjgLvnyOaf+Wx+wvEQ1sR0WxYL3Kt0MBgqP wKxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jSa433kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k26si11194602ejz.115.2020.08.10.08.01.43; Mon, 10 Aug 2020 08:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jSa433kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727023AbgHJO7A (ORCPT + 99 others); Mon, 10 Aug 2020 10:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbgHJO67 (ORCPT ); Mon, 10 Aug 2020 10:58:59 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F01CDC061756; Mon, 10 Aug 2020 07:58:58 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id r4so5024974pls.2; Mon, 10 Aug 2020 07:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3EOXOOWYYlAj99G6WV2By0kWl8SEe77hw4rKVyQwu0k=; b=jSa433kL6JihAjzQB2FOaVyp+FMxCEVWBQ6/BOiywhrd3vANIBjSxgF2SUz3ypRjxA mDMRPSEPY3SB6ePtMUgBmIBhojD2LNaRH/ZBoUNpDgZ0IVzoJpvYYbC54yvQutNIsYo8 Vn+oNNp+cmzYEyRbML8I0jGD7bry7/jM48QFfvXlL/0oM+t7lpiamVNewmAEKcT15kZh geWKthbuDMVElHXDFzXXNXMUnrmTnimWaB+2tv89sg361HXEw4e7nnuLiIWDzsnClwRC TUMd2f2TCX0nNbVdUbdQRtpxN9T6EncjWaZosRo4lN2a4eCB3Xh9qPh0deEoWahfOy7T JR/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3EOXOOWYYlAj99G6WV2By0kWl8SEe77hw4rKVyQwu0k=; b=bGbhXnfiT9Rt2Ey/BgOrmVWaVXgNr5eZbW5gd0TeHIfvMXbqvfemabtAuuXAHH9Mzq pea64+1Xsp8NSHRLY7pO+R4zaVdpBO9v+Uip0F8Z5mUJ241ZNl4Umg5xoG5z0ZZ6AbCj iW6P/OGjixu3T5vM6Bmce/5gwsA8AXmWXBwGkNgI/0EuLon8X0k+Aalo61Vzc65D1O9F YusXZniZGOkOMFyIW49o0+HeLcrrGWYTJassRzuSAcRUhjDuLog5Qk6U4ljaG0iK2Skz k63y1uUj6ENQ2RtgQWgOnUfeUThEUDbq9DRzxTKUMS+aBYkUYKuPw1q5hjn3BTIljvKW 2y6w== X-Gm-Message-State: AOAM531FRZpxQaonYvA8jd00Vh3b1BWfiwnj9BfEocw5apByba+z5aUB TCTYG/M0iXUGlymr9sK2FteLAP39v/A= X-Received: by 2002:a17:90a:ff85:: with SMTP id hf5mr26790162pjb.79.1597071538285; Mon, 10 Aug 2020 07:58:58 -0700 (PDT) Received: from localhost.localdomain ([124.170.227.101]) by smtp.gmail.com with ESMTPSA id o192sm25631162pfg.81.2020.08.10.07.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2020 07:58:57 -0700 (PDT) From: Eugene Lubarsky To: linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, adobriyan@gmail.com, avagin@gmail.com, dsahern@gmail.com Subject: [RFC PATCH 0/5] Introduce /proc/all/ to gather stats from all processes Date: Tue, 11 Aug 2020 00:58:47 +1000 Message-Id: <20200810145852.9330-1-elubarsky.linux@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an idea for substantially reducing the number of syscalls needed by monitoring tools whilst mostly re-using the existing API. The proposed files in this proof-of-concept patch set are: * /proc/all/stat A stat line for each process in the existing format. * /proc/all/statm statm lines but starting with a PID column. * /proc/all/status status info for all processes in the existing format. * /proc/all/io The existing /proc/pid/io data but formatted as a single line for each process, similarly to stat/statm, with a PID column added. * /proc/all/statx Gathers info from stat, statm and io; the purpose is actually not so much to reduce syscalls but to help userspace be more efficient by not having to store data in e.g. hashtables in order to gather it from separate /proc/all/ files. The format proposed here starts with the unchanged stat line and begins the other info with a few characters, repeating for each process: ... 25 (cat) R 1 1 0 0 -1 4194304 185 0 16 0 2 0 0 0 20 ... m 662 188 167 5 0 112 0 io 4292 0 12 0 0 0 0 ... There has been a proposal with some overlapping goals: /proc/task-diag (https://github.com/avagin/linux-task-diag), but I'm not sure about its current status. Best Wishes, Eugene Eugene Lubarsky (5): fs/proc: Introduce /proc/all/stat fs/proc: Introduce /proc/all/statm fs/proc: Introduce /proc/all/status fs/proc: Introduce /proc/all/io fs/proc: Introduce /proc/all/statx fs/proc/base.c | 215 +++++++++++++++++++++++++++++++++++++++++++-- fs/proc/internal.h | 1 + fs/proc/root.c | 1 + 3 files changed, 210 insertions(+), 7 deletions(-) -- 2.25.1