From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8A64C433F5 for ; Wed, 6 Oct 2021 04:10:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AF526120F for ; Wed, 6 Oct 2021 04:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbhJFEMQ (ORCPT ); Wed, 6 Oct 2021 00:12:16 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:23351 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbhJFEMP (ORCPT ); Wed, 6 Oct 2021 00:12:15 -0400 Received: from dggeml754-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HPLTy1TsrzRZJ4; Wed, 6 Oct 2021 12:05:58 +0800 (CST) Received: from [10.174.177.21] (10.174.177.21) by dggeml754-chm.china.huawei.com (10.1.199.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 6 Oct 2021 12:10:20 +0800 Subject: Re: [RFC 1/8] sched: Add nice value change notifier To: Tvrtko Ursulin , CC: , , Tvrtko Ursulin , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot References: <20211004143650.699120-1-tvrtko.ursulin@linux.intel.com> <20211004143650.699120-2-tvrtko.ursulin@linux.intel.com> From: "Wanghui (John)" Message-ID: <562d45e1-4a27-3252-f615-3ab1ef531f2b@huawei.com> Date: Wed, 6 Oct 2021 12:10:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211004143650.699120-2-tvrtko.ursulin@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.21] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeml754-chm.china.huawei.com (10.1.199.153) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HI Tvrtko On 2021/10/4 22:36, Tvrtko Ursulin wrote: > void set_user_nice(struct task_struct *p, long nice) > { > bool queued, running; > - int old_prio; > + int old_prio, ret; > struct rq_flags rf; > struct rq *rq; > > @@ -6915,6 +6947,9 @@ void set_user_nice(struct task_struct *p, long nice) > > out_unlock: > task_rq_unlock(rq, p, &rf); > + > + ret = atomic_notifier_call_chain(&user_nice_notifier_list, nice, p); > + WARN_ON_ONCE(ret != NOTIFY_DONE); > } How about adding a new "io_nice" to task_struct,and move the call chain to sched_setattr/getattr, there are two benefits: 1. Decoupled with fair scheduelr. In our use case, high priority tasks often use rt scheduler. 2. The range of value don't need to be bound to -20~19 or 0~139