Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5644075ybl; Tue, 27 Aug 2019 07:44:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlmKqMZbi99oiStADyebTMoxOkxyMkNJCx0TLapFtHlChmekrFGF+EYPD0PSe/sD8KpUKB X-Received: by 2002:a65:6547:: with SMTP id a7mr21279883pgw.65.1566917042446; Tue, 27 Aug 2019 07:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566917042; cv=none; d=google.com; s=arc-20160816; b=HouvEwG3hlgJa2Yab6UuyszcnB0VDCi2jkQLZ+ck89279loH0MI5fVE2TDOgIDsjtS 7vw9OZRT0DZNcO7SjDPhoNXTuVGzXagy/y6QE1/BFR6JpGBEaVw7Uw15qY06JkL4ufxn kcV1/bp5RDmWw5sTtk3Nh23+X4k3XjbEEafd6VvuB9tzPeisP40GOTwHyZ0vLTwCGJmA gTTN5RVDDAJH8dXgBYjmRSrLdZ7HpkRWhPRpJ5K5VVWoMaK2RnP93UOoLo61+VQ1i8pI xIMCjJ0+mebcX0BMrUp5JsyyEqOqrsI9AE9XOSaEOHUdcdxvWjG5/zzqR8za+wpXbcGA Yviw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=+zijGjINhGH91TaBAnQ3Q/8FIgCxq1bWLSCpkecn7Pk=; b=AxSxrfIqCjScYQdXZ/Ma4y5ALaNc0MkloppQ2D4nk3nv6BpNkW4wjPW2/e54rWZ68o 6+oOcPss3Mkts3m3rQSc6lZftucTQJtiHY+wPu9XWZGzMBloNVzZTKvyvMnmoq5gYsnX qqcCoUZahaIrO16OfPCKBgYoi5JRLwDDBYQtSxkyx+V8UgeiFQi2bn4Ops7sX7KAo/VV Vd6XHaBNzp0d6GNpQORbTggSbyE517nb5zMPT5aCtsDb4QscFE/Nh5nJJINCZK/2R7vU zV4+63XNEqDmWNW2QuhS//etrQqtSQzy+YrcXwAyOVdOJpdK3aOj7vtbgvgEGehtaG32 CDsQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si11920599pgr.103.2019.08.27.07.43.46; Tue, 27 Aug 2019 07:44:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730001AbfH0Omk (ORCPT + 99 others); Tue, 27 Aug 2019 10:42:40 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:43993 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbfH0Omk (ORCPT ); Tue, 27 Aug 2019 10:42:40 -0400 Received: from p5de0b6c5.dip0.t-ipconnect.de ([93.224.182.197] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1i2cfc-0000BW-0E; Tue, 27 Aug 2019 16:42:04 +0200 Date: Tue, 27 Aug 2019 16:42:02 +0200 (CEST) From: Thomas Gleixner To: Ming Lei cc: linux-kernel@vger.kernel.org, Long Li , Ingo Molnar , Peter Zijlstra , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , John Garry , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH 1/4] softirq: implement IRQ flood detection mechanism In-Reply-To: <20190827085344.30799-2-ming.lei@redhat.com> Message-ID: References: <20190827085344.30799-1-ming.lei@redhat.com> <20190827085344.30799-2-ming.lei@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Aug 2019, Ming Lei wrote: > +/* > + * Update average irq interval with the Exponential Weighted Moving > + * Average(EWMA) > + */ > +static void irq_update_interval(void) > +{ > +#define IRQ_INTERVAL_EWMA_WEIGHT 128 > +#define IRQ_INTERVAL_EWMA_PREV_FACTOR 127 > +#define IRQ_INTERVAL_EWMA_CURR_FACTOR (IRQ_INTERVAL_EWMA_WEIGHT - \ > + IRQ_INTERVAL_EWMA_PREV_FACTOR) Please do not stick defines into a function body. That's horrible. > + > + int cpu = raw_smp_processor_id(); > + struct irq_interval *inter = per_cpu_ptr(&avg_irq_interval, cpu); > + u64 delta = sched_clock_cpu(cpu) - inter->last_irq_end; Why are you doing that raw_smp_processor_id() dance? The call site has interrupts and preemption disabled. Also how is that supposed to work when sched_clock is jiffies based? > + inter->avg = (inter->avg * IRQ_INTERVAL_EWMA_PREV_FACTOR + > + delta * IRQ_INTERVAL_EWMA_CURR_FACTOR) / > + IRQ_INTERVAL_EWMA_WEIGHT; We definitely are not going to have a 64bit multiplication and division on every interrupt. Asided of that this breaks 32bit builds all over the place. Thanks, tglx