Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1095132imu; Fri, 11 Jan 2019 15:06:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN66m1YIJTOAgCBVoOw0oH4m97wvphnQtFglq9Ex3KlAF3w+Eg4Z0AMW5vyeU90mYKRDHSzI X-Received: by 2002:a17:902:f20d:: with SMTP id gn13mr15828207plb.11.1547247975167; Fri, 11 Jan 2019 15:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547247975; cv=none; d=google.com; s=arc-20160816; b=Jhbqmb8R29FBHNal3K6VU4Om/kNtR4LIQ9z8SWxWNSCMoYQolces0hEW103IZuUnFG luPYAiuVpwlL1hodqgXw6PUQ8hicsPBSc/FsSgdg65DJeDgPW2U7+mWTqIcn8FKoH4D3 Nq6cwIewpviryFLa9n9i7SKNWXBJ2i68D7e5nMzLkBwi2bbUqliCLa1sisLHqQ/YrrWZ Zb+BzYV3/TLcFFl9TQC6k3Fc9NYUMuznG6/yrGP/OAGSBuNQg+mN2t2Jv+xDXMdAU0xx 8DlDaVrTkB4memboT8+5SbFFpibhVze05KstRS8ZcR3tJW4bCvGZS/Tqo41Kd+RS14ay M3Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AQ5h+xhK2WPV3aQfmhX+HBY2D680bNRzz82XYueIohA=; b=cTqROkcuxEVkL0qsWaBf2F5BsUozd5a86IXf9W6ZCUaRVQ/skfVyFyBIkBJroKSmkm PVQxHpJusQOpicUUguHON5PTQKWKv9hkGbczsRBtuL9hsjd3AOI1bnj1vwISa1GKoAbI 18GuJ35oejX1TG05oZvZ7hyfs6pMcsOKboW+e1jCg0+ChLx8becz+DYtOcpKOIkOXZy1 vYWWavKYbYXkb8bIpZJpesepI3OjS9+5ScscvwZndlHYekGFusTZ/IaKzq2hRvF6g8ZM cXWRWoXTGHo7/EKgXj2oF+EtAyPdVtyeyBuYxUKdvcTwQf4blX7HuOmF20sjo+l65ta3 B0Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B6IntYz1; 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 r14si34954572pgk.75.2019.01.11.15.05.59; Fri, 11 Jan 2019 15:06:15 -0800 (PST) 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=B6IntYz1; 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 S1726094AbfAKXDs (ORCPT + 99 others); Fri, 11 Jan 2019 18:03:48 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40181 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbfAKXDs (ORCPT ); Fri, 11 Jan 2019 18:03:48 -0500 Received: by mail-wr1-f66.google.com with SMTP id p4so16862498wrt.7; Fri, 11 Jan 2019 15:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AQ5h+xhK2WPV3aQfmhX+HBY2D680bNRzz82XYueIohA=; b=B6IntYz1GV6y+FhWWvCe3tDRV6+tvOAoovxxtpx6Ath6vNrbApzS5YWy57NucML9Hq 1D95DSlqzP4ikM6GQrsGLcQGJCd86YXG9qCyFAo65lzmfHZxbZm4Zl9zBVa06Yfj0Z/k N3aG+TIANtKd9f+0O90U6U0kNK/j2gdU1Sw4tP/ONSTw0zVrMKnChySKyngwcWR1xrnh 7mm4YFutSaB2Qe5tGUC7EDwV53OqObCsiHemD5GYiBEJYVLo6jDwFPEj28G/R84S+Q+f uAV36jp2jT+WVTyAGR5MOkiE/IO1FwjkHZgFZOQOfG/HUl0wOo3QRUdgEpVRfFXQ5C7R 50Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AQ5h+xhK2WPV3aQfmhX+HBY2D680bNRzz82XYueIohA=; b=AUm2ljL63m9zBZKrI10exfvlQy+SRvPByyrC1B/RjPnJ0JNnZ1wk9mXMZMVAWQA3pm 8wUczzQirQPtbhvCxf+zozEkX2xZoov0RDdEYyh64yqCf7oU6Y1c9xw6RjcGfwb6qFEu 8TPQFCsTUbjI3HrMxw0sn09jeH0OSSY5SHgAdXRHPD709ekz4eLxngBTqOLxoQ5mgsej KlHXWNjF5V195QF2LVTijqJT9z4BMqVve86zmJ73wK/6632oj+CaMeUuK2DGPKGzRMwe CfQpXsCaLn21VRk3F9dWuCf/Xm+p54jjYTLDkXWHMVYffWievLYpp9qqkBe6zo5JTkhw yDmw== X-Gm-Message-State: AJcUukewbsAwc7/vUmWvZyHhgCAOHQJrpTiz/8eM1wOHQx6q0MfeUsu8 qJg87Xrb8i3tV3b5Pqx5quENI/0= X-Received: by 2002:adf:92a4:: with SMTP id 33mr14999367wrn.11.1547247826558; Fri, 11 Jan 2019 15:03:46 -0800 (PST) Received: from avx2 (nat-minsk-pool-46-53-201-92.telecom.by. [46.53.201.92]) by smtp.gmail.com with ESMTPSA id k3sm102630279wrm.7.2019.01.11.15.03.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 15:03:45 -0800 (PST) Date: Sat, 12 Jan 2019 02:03:43 +0300 From: Alexey Dobriyan To: Tan Hu Cc: zhong.weidong@zte.com.cn, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] proc: only export statistics of softirqs for online cpus Message-ID: <20190111230343.GA20267@avx2> References: <1547119441-28314-1-git-send-email-tan.hu@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1547119441-28314-1-git-send-email-tan.hu@zte.com.cn> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 07:24:01PM +0800, Tan Hu wrote: > @@ -12,13 +12,13 @@ static int show_softirqs(struct seq_file *p, void *v) > int i, j; > > seq_puts(p, " "); > - for_each_possible_cpu(i) > + for_each_online_cpu(i) > seq_printf(p, "CPU%-8d", i); > seq_putc(p, '\n'); > > for (i = 0; i < NR_SOFTIRQS; i++) { > seq_printf(p, "%12s:", softirq_to_name[i]); > - for_each_possible_cpu(j) > + for_each_online_cpu(j) > seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); > seq_putc(p, '\n'); > } This should break userspace: https://sources.debian.org/src/netsniff-ng/0.6.5-1/ifpps.c/#L330 This code gets the number of "possible" CPUs from sysconf(3) and doesn't parse header to find out which CPUs are online.