Received: by 10.192.165.148 with SMTP id m20csp73376imm; Thu, 19 Apr 2018 16:24:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx48QXb7+lxK5fOsTHzdM4FmPuYxF80HKdniVVm3N1/K2pBVssc4UggqEakirAKflizcTSpwq X-Received: by 10.99.164.18 with SMTP id c18mr6593687pgf.85.1524180295965; Thu, 19 Apr 2018 16:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524180295; cv=none; d=google.com; s=arc-20160816; b=RInoBE4PeptKZsBiRRHvYEohLInvy7mk3NPf9+euq436W3Jr/TaDL4UwIRgojmxF07 770mwjJ+hjWYk94suAatsaXNRGeW0rzx8g6pUGIRukd3fIUXGN04WqDdtzwF6lVIUI9T kchBvDXv7dBkcdyK8nG4nPIl3EZO/NsJS3uMLcm2iKii2dyshXIvH/EKhfoRCX85vTu0 T7kwVDdHYiIC+t61iB2qMOqJn29FqOM1tq3/S5zG8epkz8e1ci6Srsy2aarOiHxLUtFR JrrtPNRpqNya27oOwvqu6dF3xTWJkakySit7ra6X2rCa8AGbT2FACJBktcErLvqoQUav 6cyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=gQTrs7QcOAyXPEf7y7FYZiTLhqr603qQNGD9qebDAH0=; b=xgdbNomVEiRYAwrvK/IfgpbH0f6G34GmHRm+tL4wH2ChpUBCbcUr5fWQtBxOj8oyw1 1HE3MkhEQyBfLxT130EF66AyGKnW2JPlIm9E7rIAHntcybNvtUznn+vW52A3uNxFVDPN O/1GBQ9fGFY+XShTrBH2Vz0zTap9CzTQlkzij3Pn6pw/iO9V9Oe9ZAZKYStYaFNiH5fn uK5b2yjWr37FdVbtozLflfW9tJ+wQhUhR+7w6YtpTnoVXRboOpsUMlCA5Xaf9x8awfJf ggTOA6pRDNPsFHR5bqh0W0b3M5AsYk04nIs5951Hn3bKTA7foee2jT3F7cAmeRndx42n dPxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mH+p3D7S; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si3740239pgq.76.2018.04.19.16.24.41; Thu, 19 Apr 2018 16:24:55 -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=@gmail.com header.s=20161025 header.b=mH+p3D7S; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753863AbeDSXXH (ORCPT + 99 others); Thu, 19 Apr 2018 19:23:07 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:35670 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753575AbeDSXXE (ORCPT ); Thu, 19 Apr 2018 19:23:04 -0400 Received: by mail-wr0-f172.google.com with SMTP id w3-v6so18207147wrg.2 for ; Thu, 19 Apr 2018 16:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gQTrs7QcOAyXPEf7y7FYZiTLhqr603qQNGD9qebDAH0=; b=mH+p3D7StGVLuhGo5gAVBl2cpsKMRN04I2lfgHUtee63Y9+nw4ASdk58nKDMp52EUY OdjgNyJmiMWJMXX7oB/HFzwHgVJxbJY/5N41ztTsEgayheTMG/YQ9qKwRZeWw/f8sJ32 YqpH/UrKXYzrCjPsHGHHxDfiaNq8Zyb2TKha12YAkTl50ovJw9ZhYfSq3+ds8x718wEG 243I9Prp4KsbF8Ez8maJ8XSmqPcQziMNirC64k/sbflCWFxI+P9Ihz7dHyaHjbIp0xGV 1ODLOHOsfD+k4vlGLR4Fr8mtmyCvoIg8UqstUzWwaNbXT6CjQqz8egMNIkFYSmbJ22bO vjQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gQTrs7QcOAyXPEf7y7FYZiTLhqr603qQNGD9qebDAH0=; b=bTcfEvDCpS0/xBRhTebXWMPmraFKUwRuSwie4jooDExtFMWOiJ+8Eq+G+w/cHCpWCg JXFY2aNNGjCGwtdKeIeQ3LmuqrIHB6gpEfVrLNYsAW6dW3GsY5mQ4FVG6ZkNAG2hz4mT FRYnyVMAhwzjX/a3hEq2Iq5g1C5NS01/kh7SZZkY+ECv/wjflMgjQ4uCIsk87UUE65WZ TyQrQ4/oB5wegUFO9L9MqypIRFZJLL+wzCGBzBI77SjmLAmohsOHg8tIRxgCUBOj995e mW2I0+3Ojev267JNgMI5mtiV5n+YApOVQMdv9OGag4/oP7JGljpjq6Bz+3gp5ZJ5D5A3 gcfg== X-Gm-Message-State: ALQs6tDkSbKvv0VDstMkKkTlP8xhRqjMHAv09SgOSSq2Zdv1oeC7WyBi /GoTV4d4Gcieroq2nUBSJg67PpYkDb1khAO0KxQ= X-Received: by 10.80.132.7 with SMTP id 7mr10628792edp.139.1524180183247; Thu, 19 Apr 2018 16:23:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.145.91 with HTTP; Thu, 19 Apr 2018 16:23:02 -0700 (PDT) In-Reply-To: References: <20180419190846.GE2066@avx2> <1c3b9cf3-3a36-568f-3da2-e560a721f4aa@redhat.com> <20180419195504.GA4343@avx2> <20180419203949.GA4555@avx2> From: "Joel Fernandes (Google)" Date: Thu, 19 Apr 2018 16:23:02 -0700 Message-ID: Subject: Re: [PATCH] proc/stat: Separate out individual irq counts into /proc/stat_irqs To: Waiman Long Cc: Alexey Dobriyan , Linux Kernel Mailing List , rdunlap@infradead.org, Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, >>>> Or maintain array of registered irqs and iterate over them only. >>> Right, we can allocate a bitmap of used irqs to do that. >>> >>>> I have another idea. >>>> >>>> perf record shows mutex_lock/mutex_unlock at the top. >>>> Most of them are irq mutex not seqfile mutex as there are many more >>>> interrupts than reads. Take it once. >>>> >>> How many cpus are in your test system? In that skylake server, it was >>> the per-cpu summing operation of the irq counts that was consuming most >>> of the time for reading /proc/stat. I think we can certainly try to >>> optimize the lock taking. >> It's 16x(NR_IRQS: 4352, nr_irqs: 960, preallocated irqs: 16) >> Given that irq registering is rare operation, maintaining sorted array >> of irq should be the best option. >>> For the time being, I think I am going to have a clone /proc/stat2 as >>> suggested in my earlier email. Alternatively, I can put that somewhere >>> in sysfs if you have a good idea of where I can put it. >> sysfs is strictly one-value-per-file. >> >>> I will also look into ways to optimize the current per-IRQ stats >>> handling, but it will come later. >> There is always a time-honored way of ioctl(2) switching irq info off >> /proc supports that. >> >> There are many options. > > OK, it is good to know. Do you have any existing code snippet in the > kernel that I can use as reference on how to use ioctl(2) switching? > > I will look into how to optimize the existing per-IRQ stats code first > before venturing into cloning /proc/stat. Can we not just remove per-IRQ stats from /proc/stat (since I gather from this discussion it isn't scalable), and just have applications that need per-IRQ stats use /proc/interrupts ? thanks, - Joel