Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3746173ybd; Tue, 25 Jun 2019 07:48:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFaCtXbroySl61KZRb82C/VrutGGPDp17NJ5b8ytZ1NKxvATjBEfGwAvS5sK1QDC5yE213 X-Received: by 2002:a65:41c6:: with SMTP id b6mr38436279pgq.399.1561474125500; Tue, 25 Jun 2019 07:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561474125; cv=none; d=google.com; s=arc-20160816; b=b6x6YEhOIc5u8RdN03l3jzglDGy/sWScL+VpwrWrKSmWeWZ4VQcMyUatd/k/zy6bPV ohFca+VxBlxtjgw3UPq7xervDZirRDDiUDUGnIOo1ab7DD6dLZPedySwyHGx0ohjuqvM OdSmwAFzVBn+KUVCoVuDnF5XJaRwDllyDP8Yi/nnzmLTouKIe3/xe4wVYd1sePDzrjBK dZQo+IQOq4bzuQZBkPgEwpHzFFRYh/jbYpZtfMy6eTCLE3OHUm25xSXyvb86drAy4kl1 74B9/R4cjY9hB1vLZUaov7PKPb7lB7d8ci20Im2w/LcTB6dsI2EZcNI58KSqDbqjbCCl xqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=/o+P+0sgbOKWEWNNmEvyQ1TYeYplmOOr+aASow/R3Og=; b=AQ2Wvb5gXG0i9wyg4mU8U3jSagSCdN/mhH2x8p7qBzddQXE9JbqY/11HOzX6tRzv16 codgLDuasg4PNcIeY8EdZUbx+3xpWNgtSUyHeohERcX/cNQ2o4VxwtoD2XvY2Ul/X4LL vOe74mjr8F6ksWhjPf0SpjBcYw1OivpS+ntYaCLGMVH2ubQ7K9ObTs9j7GbMllZAevS0 6apkZKxqV/hwPmBTDLtt6VVckgPQc8TjLBibwyC7UKdwqL7Xgb2nVapeXBWTb8fklFK2 +nb0t34MwIvYINNr+ExxO8nHvcuq3DUxW8CrBhdqWZGmP7zSQaml1h66xhhiONjqNgLE I67g== 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 br15si2652673pjb.43.2019.06.25.07.48.28; Tue, 25 Jun 2019 07:48:45 -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 S1731506AbfFYOrD (ORCPT + 99 others); Tue, 25 Jun 2019 10:47:03 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:19110 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730505AbfFYOrD (ORCPT ); Tue, 25 Jun 2019 10:47:03 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 94D0D86399F050714BE1; Tue, 25 Jun 2019 22:46:57 +0800 (CST) Received: from [127.0.0.1] (10.184.225.177) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Tue, 25 Jun 2019 22:46:47 +0800 Subject: Re: [PATCH next] softirq: enable MAX_SOFTIRQ_TIME tuning with sysctl max_softirq_time_usecs To: Thomas Gleixner CC: , , Kees Cook , , , , , , , , , , , , , "wangxiaogang (F)" , "Zhoukang (A)" , Mingfangsen , , Eric Dumazet References: <0099726a-ead3-bdbe-4c66-c8adc9a4f11b@huawei.com> From: Zhiqiang Liu Message-ID: Date: Tue, 25 Jun 2019 22:46:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.225.177] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Thomas, On 2019/6/24 17:45, Thomas Gleixner wrote: > Zhiqiang, > > On Mon, 24 Jun 2019, Zhiqiang Liu wrote: >> >> Thanks again for your detailed advice. >> As your said, the max_softirq_time_usecs setting without explaining the >> relationship with CONFIG_HZ will give a false sense of controlability. And >> the time accuracy of jiffies will result in a certain difference between the >> max_softirq_time_usecs set value and the actual value, which is in one jiffies >> range. >> >> I will add these infomation in the sysctl documentation and changelog in v2 patch. > > Please make the sysctl milliseconds based. That's the closest approximation > of useful units for this. This still has the same issues as explained > before but it's not off by 3 orders of magitude anymore. > I have a doubt about _msecs_to_jiffies funcs, especially when input m is equal to 0. For different HZ setttings, different _msecs_to_jiffies funcs will be chosen for msecs_to_jiffies func. However, the performance of different _msecs_to_jiffies is inconsistent with input m is equal to 0. If HZ satisfies the condition: HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ), the return value of _msecs_to_jiffies func with m=0 is different with different HZ setting. ------------------------------------ | HZ | MSEC_PER_SEC / HZ | return | ------------------------------------ |1000| 1 | 0 | |500 | 2 | 1 | |200 | 5 | 1 | |100 | 10 | 1 | ------------------------------------ Why only the return value of HZ=1000 is equal to 0 with m=0 ? Codes are given as follows, #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) static inline unsigned long _msecs_to_jiffies(const unsigned int m) { return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); } #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) static inline unsigned long _msecs_to_jiffies(const unsigned int m) { if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; return m * (HZ / MSEC_PER_SEC); } #else static inline unsigned long _msecs_to_jiffies(const unsigned int m) { if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) >> MSEC_TO_HZ_SHR32; } > Thanks, > > tglx >