Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp709921ybh; Wed, 22 Jul 2020 11:08:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsAeWbEIopyDvrpWkbexkB+AILTlWFHg/Zr4GuooaG8wWmoR0NUPlOimQ6sRo6F+2FGjED X-Received: by 2002:a17:906:6b8d:: with SMTP id l13mr787602ejr.136.1595441303398; Wed, 22 Jul 2020 11:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595441303; cv=none; d=google.com; s=arc-20160816; b=m63fZklV6DvFIAcLLhp4l6OUMQA7xMH+jkGm/nzGVuLr6v5xwyvjYXOi+7ItivB9xp njt1TGEMxNQ5uuGxUICol8fpsB6Rd0vK/BZD7rFUA/0D2vtYioVK+6MjGrL9ibQBjHrc 8SR9Ol2p7unkjqaLvSSFVWXu5lUAhoclRftzoELlDX0cU+HwNf80rjgHZ4oq9n4TXUsh +ic1Jin5rLol0V6AINaf30KvAZTXHWr+ZWUGTFzWk4tinaNmZxxnJkTVtRK0ghULMXgg QKSI2BTVHsfDY9W0HhSIJiQKikegwazW9yi5I+Ws3H4EORo0vs4EfNw5uOmk5M0qqkrc hP+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=HatAk6RLCg4BmgwgUUTlkbbDJ6PjhNZBQ9Tw9yFbT4I=; b=UU32O6vNHt1bfQZvPwysYKk4G7dWXvSLqZBVTe9RQ5/XlhRx1bjbY0eQOOPdZ4+WEs RCEJvff0TUhUTKeS9CO4bujn3z3aToIskvTwUDHn5oHWyi8AG0Sxn7m2zl7OqQ8kYYpS ty9k2UrFSAL1MV6CATQBTvH5ePiQ+yMsedAxBSJtzTwe9GXnfCpJAj+ggh1CFIM1mz5a 9w/oCEnbIGLoHXXlo5aNjdJJJKya4/3Uvh6tem5cPWfe8eN5ZXFltidieywxodNCvFC0 j1a+b/zWa78+CxiwLakIBBqF44ZqPhkYWtm7iCayxLPyST95O27KpHAW5JVakJe+H2yc XH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=D6XVPjQC; dkim=neutral (no key) header.i=@vger.kernel.org; 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=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si409572ejd.637.2020.07.22.11.07.59; Wed, 22 Jul 2020 11:08:23 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=D6XVPjQC; dkim=neutral (no key) header.i=@vger.kernel.org; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731695AbgGVSFZ (ORCPT + 99 others); Wed, 22 Jul 2020 14:05:25 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51030 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgGVSFY (ORCPT ); Wed, 22 Jul 2020 14:05:24 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595441122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HatAk6RLCg4BmgwgUUTlkbbDJ6PjhNZBQ9Tw9yFbT4I=; b=D6XVPjQCLKSWZPpdI6cMRuDA9c/iFta9Hfe/N1dPr6/12SHs+OIA610WTO40fMTDT8z6ge /RSxszDgWdBIe799CF4MT8UstcEUOjilZhXdTVMDCtHgBF49wKhzs+SX1twfEd1A+j0yUL 5iNnObdWMRql4ZklLvAd0b4nsx+W9xAFA/K9ZEDoRbhRTH9MwAdKrglBp+0fj1daIz4DrX mI26ifz6kZLk8C17WN0sSlmJNPHNhRgk2VX74Qmu95rjX4q+6pY4QV0Z1WXkJdIWdzqnoY 5fU87CNL8G/bikUObRBX5loS26/YRmfX5giqK5yLUdGDOMUW7aGjBmprriSjEg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595441122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HatAk6RLCg4BmgwgUUTlkbbDJ6PjhNZBQ9Tw9yFbT4I=; b=ZhTW850ki2WWzZ/FyUzSmrmqxZoHdvwjEDV12BXjtl4VwAvQTYr1aerN3GKu9kzCRfeuXu UhUMe1c0p5Oo4zAg== To: qianjun.kernel@gmail.com, peterz@infradead.org, will@kernel.org, luto@kernel.org, linux-kernel@vger.kernel.org, urezki@gmail.com Cc: laoar.shao@gmail.com, jun qian Subject: Re: [RFC PATCH v2] Softirq:avoid large sched delay from the pending softirqs In-Reply-To: <1595250506-9769-1-git-send-email-qianjun.kernel@gmail.com> References: <1595250506-9769-1-git-send-email-qianjun.kernel@gmail.com> Date: Wed, 22 Jul 2020 20:05:22 +0200 Message-ID: <87eep32zod.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org qianjun.kernel@gmail.com writes: > + > + end = ktime_get(); > + delta = ktime_to_us(end - start); What's the point of this conversion? That's a division for no value because you can simply define the maximum time in nanoseconds with the same effect, i.e. ktime_t end = ktime_get() + MAX_SOFTIRQ_TIME_NS; if (need_resched() && ktime_get() > end) break; So you can spare all that start, delta and conversion dance and keep the code simple. Also notice that need_resched() wants to be evaluated first because there is no point to do the more expensive time read if need_resched() is false. Thanks, tglx