From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ilvokhin.com (mail.ilvokhin.com [178.62.254.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFAE03D6CD7 for ; Tue, 31 Mar 2026 16:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.254.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774973076; cv=none; b=CuUpCTfcxf5wf5D3yP6t1RocNyYlYYgT8FUGSaI6vi182+2Cs5kFCcaVe+gZIFw2CXdmJd/LL302CU180RX8yLMzF6GAinD7lGOexMOixyLx2sZXie+gnCuNe50l/Sz4xa1wMnXyPs1H7srNF2Nh+iOHyaZXI1v1UQMAF1m5sVo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774973076; c=relaxed/simple; bh=seqz6iY4LbuPhE22UqmCiIW609mAtwy8EC6v4hSmnCQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eWaQJhdP8MEKKf7dMPRkmyaJZECts5DS7CEzqRmK55RwG1B8xag8X1Uf0/Rcf/U64x+K0D8x6DUtrgWIF5eRKatzPisFG9jjreEn1VOxVw8ttX+UCNSexGxlFpyQr64st3THlYJSGnYNo/WGEfhnp3qCKGZtYkbyITP8j6AQVb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com; spf=pass smtp.mailfrom=ilvokhin.com; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b=vpZjRcfj; arc=none smtp.client-ip=178.62.254.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b="vpZjRcfj" Received: from shell.ilvokhin.com (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id C443ABE28F; Tue, 31 Mar 2026 16:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1774973072; bh=v2wdrKOC/sPWbSX76WT8/3EH5v2GrSAQEPG66l/7al0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=vpZjRcfjq919jZ1StlSnCssGWOBfl/zDn0V3rsV5oDMnXRzDy9VO9dcIO4QCQo+I4 hoQhgh1xdIkz/aFS2eH6Xh46fY8PjxQyJ49mV9w7LRVxZCZGRf/1+VHrbzNo7v41Ic obZNEQkJwEy/Oa3JzyamMTXO7hLUWW8zEGCmyLwk= Date: Tue, 31 Mar 2026 16:04:31 +0000 From: Dmitry Ilvokhin To: Thomas Gleixner Cc: LKML , x86@kernel.org, Michael Kelley , Radu Rendec , Jan Kiszka , Kieran Bingham , Florian Fainelli , Marc Zyngier Subject: Re: [patch V4 15/15] genirq/proc: Speed up /proc/interrupts iteration Message-ID: References: <20260331071453.172185305@kernel.org> <20260331072419.549056774@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260331072419.549056774@kernel.org> On Tue, Mar 31, 2026 at 09:26:40AM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Reading /proc/interrupts iterates over the interrupt number space one by > one and looks up the descriptors one by one. That's just a waste of time. > > When CONFIG_GENERIC_IRQ_SHOW is enabled this can utilize the maple tree and > cache the descriptor pointer efficiently for the sequence file operations. > > Implement a CONFIG_GENERIC_IRQ_SHOW specific version in the core code and > leave the fs/proc/ variant for the legacy architectures which ignore generic > code. > > This reduces the time wasted for looking up the next record significantly. > > Signed-off-by: Thomas Gleixner > --- [...] > > - /* print header and calculate the width of the first column */ > - if (i == 0) { > - seq_printf(p, "%*s", prec + 8, ""); > - for_each_online_cpu(j) > - seq_printf(p, "CPU%-8d", j); > + /* print header for the first interrupt indicated by !p>private */ nit: This comment seems a bit out of place here, since we are looking at constr->print_header directly here. > + if (constr->print_header) { > + unsigned int cpu; > + > + seq_printf(p, "%*s", constr->num_prec + 8, ""); > + for_each_online_cpu(cpu) > + seq_printf(p, "CPU%-8d", cpu); > seq_putc(p, '\n'); > + constr->print_header = false; > } While at it, moving the print_header block above the ARCH_PROC_IRQDESC check would make the code more robust. If there are no valid descriptors to display, the CPU column header would still be printed before arch_show_interrupts() output. Not a practical issue, but it makes the logic obviously correct. Reviewed-by: Dmitry Ilvokhin