Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3050006pxb; Sun, 31 Jan 2021 02:38:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiSB0n9Qk5k9fO0Hf5tOOD/NcOkLZevQaq37hnmM4WTuwdBibQhgCUJqSz52kn+8IU8hzZ X-Received: by 2002:aa7:d304:: with SMTP id p4mr13166819edq.144.1612089488379; Sun, 31 Jan 2021 02:38:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612089488; cv=none; d=google.com; s=arc-20160816; b=lwMDMAmSLhGCVkXgrnUz2x2+713roZDfGIntMgSahkIjU7EilCc08oYWcqlKhMxzKn O6fPlJURL+mQs7/bXma/ek4b1Llu12p7vs9mc/EzO5vWRmJIK+PQ1+RnHtyAyIuY+oNR ha3fl8MDbdAHXmPQsl5ikfU9I26sUcRuFcuRgVByuq9hfEc+HYntc7QxJp4C3pIBQyVU aFV2af37Tsunxspm7keLSKtwIPSwBmb/MId/UkkY6svJsMEnF+m8uGXA1oC/VMSO1j4B zTjMyAqKczK4Bqiowk+JiFNuRSpjlE9FsoDNTev5WCo0TS0wpZKsnV+viEraBbYbOuPV VClg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hx2GPHzlwmPIRAoDcggObfL1uTwYd5oeF3q85xHfwrU=; b=BzIcY9HAjHyJDzcUqAbDpYlh+jm4k3rTWFh493RTzrShvpwX8bYv4HsxbQetuVdiJx fNXL6TMrNFntfkY3Buq1cehnWiGtYHqx/Pec72BbHH7S4cnKvU2TYbupNbjD92Bl6pga kLH13vF57CY6kJw9rVzBhkBE94Ksk+QijCn+FOIUB1Fenj6O4D00j3s41gbzpSBEXKQQ nN01RtjBnE6jDKYVAkyainHdUCYhudlWZda2pCfD6QdRAUlUIbNeb4qvc/ctsZctnFeE eqKdxEufJB4sF2h0p/Hlk8cmwsH8+2I1cqiQaWBZtA9/v02HQSUu5dR4ULWMWOirNKGX g0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bHybQXZW; 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 x11si8283660ejs.461.2021.01.31.02.37.43; Sun, 31 Jan 2021 02:38:08 -0800 (PST) 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=bHybQXZW; 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 S229926AbhAaJRu (ORCPT + 99 others); Sun, 31 Jan 2021 04:17:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbhAaJRk (ORCPT ); Sun, 31 Jan 2021 04:17:40 -0500 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 390FCC061573 for ; Sun, 31 Jan 2021 01:16:59 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id h21so6718247qvb.8 for ; Sun, 31 Jan 2021 01:16:59 -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=hx2GPHzlwmPIRAoDcggObfL1uTwYd5oeF3q85xHfwrU=; b=bHybQXZW3macaYAj1HO2ut7C1yneeG3kETaS/cLSpVLKxoscrV327tg12FAs5KC5C6 G6JDmqe6iDIdhtMffu62Orrathzz4yUIkt25S2QQIPw2JDRPArbE8Bh61s1f1vReUDPh cNHCfqBO5yJXZru/2Nk0GJGn7nRSS1StKw3AqgAL44nhD1lt4yUUmekw4MBIqODO5ps0 uD057LKtMj1QjX9WRQRIoDMsskOnGcnsZAmBqThjZ/ckUT1R/X7FhkSeinJuFZ/sK0Jw dCOrShG8SOypi5djXR/DqqX7nQZM+xVDaZr2+HBWTr0Gyxi/x9IaxUhfjyOvuFuX3bz1 TGkg== 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=hx2GPHzlwmPIRAoDcggObfL1uTwYd5oeF3q85xHfwrU=; b=c9Wzwemfg/MZeEzMelNlMIr/d/SQkyAbk0xMk9h6py2BZ9BmMdpV4kD98OL5LkXC+9 s4PeQR6oKjBhwwW5WgZ9sI4VxpW4xuHxrr3VyrtX3hvLkMwIPB3sPf5HDHI04DmiZDUw c/seYu6AaaLKwlGsIQx5bfJHDGh/aP1U70zeJsvipKl8tWtbsDCMMKgdRs0YNqb53Jt5 6wu0ouAwBzFBcGt0OCvPePbOXBdLHVgaif/5KUomB3QEHTnf0+dG+HSFFwsfuLthgQkS iLOLCQikrBVKeK82pQW0I3RB9uEqWYLjZTvb1xMhb4sFDcKVU2XBdpi2/9tbtXfhOp3x esOA== X-Gm-Message-State: AOAM530naP+kghb6bZTb6/JVzsa1vH/18fhUzcm5lToMVTPMV2AkaHWA YMXQDBeeOMEuq960Wrz/cKeDsa+ILD+aM9ed1pNhz7qB0zFYGg== X-Received: by 2002:a0c:ebc2:: with SMTP id k2mr7998014qvq.0.1612084618439; Sun, 31 Jan 2021 01:16:58 -0800 (PST) MIME-Version: 1.0 References: <20201217170009.GA29186@192.168.3.9> <20210127111346.GB59838@balbir-desktop> In-Reply-To: <20210127111346.GB59838@balbir-desktop> From: Weiping Zhang Date: Sun, 31 Jan 2021 17:16:47 +0800 Message-ID: Subject: Re: [RFC PATCH v2] taskstats: add /proc/taskstats to fetch pid/tgid status To: Balbir Singh Cc: sblbir@amazon.com, davem@davemloft.net, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 27, 2021 at 7:13 PM Balbir Singh wrote: > > On Fri, Jan 22, 2021 at 10:07:50PM +0800, Weiping Zhang wrote: > > Hello Balbir Singh, > > > > Could you help review this patch, thanks > > > > On Mon, Dec 28, 2020 at 10:10 PM Weiping Zhang wrote: > > > > > > Hi David, > > > > > > Could you help review this patch ? > > > > > > thanks > > > > > > On Fri, Dec 18, 2020 at 1:24 AM Weiping Zhang > > > wrote: > > > > > > > > If a program needs monitor lots of process's status, it needs two > > > > syscalls for every process. The first one is telling kernel which > > > > pid/tgid should be monitored by send a command(write socket) to kernel. > > > > The second one is read the statistics by read socket. This patch add > > > > a new interface /proc/taskstats to reduce two syscalls to one ioctl. > > > > The user just set the target pid/tgid to the struct taskstats.ac_pid, > > > > then kernel will collect statistics for that pid/tgid. > > > > > > > > Signed-off-by: Weiping Zhang > > Could you elaborate on the overhead your seeing for the syscalls? I am not > in favour of adding new IOCTL's. > > Balbir Singh. Hello Balbir Singh, Sorry for late reply, I do a performance test between netlink mode and ioctl mode, monitor 1000 and 10000 sleep processes, the netlink mode cost more time than ioctl mode, that is to say ioctl mode can save some cpu resource and has a quickly reponse especially when monitor lot of process. proccess-count netlink ioctl --------------------------------------------- 1000 0.004446851 0.001553733 10000 0.047024986 0.023290664 you can get the test demo code from the following link https://github.com/dublio/tools/tree/master/c/taskstat Thanks Weiping