Received: by 2002:a05:6a10:4a91:0:0:0:0 with SMTP id mf17csp2766951pxb; Tue, 5 Oct 2021 21:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx21GimuBqcmRJ7Nsw4tK1iTapZS1bUuRM0A+gl++XqEiehAMqKf8JcKLAAw0fxZb3I+3Vu X-Received: by 2002:a50:cfcd:: with SMTP id i13mr31291223edk.24.1633493668230; Tue, 05 Oct 2021 21:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633493668; cv=none; d=google.com; s=arc-20160816; b=IgA7pAjYj0HIqf8521IoWtg7YIp4JRPVqtUbOVC3W59eXq0CO8CsbRMUBvAtGJvrIZ yQRkFxW5V6s9Fsf/ARDKbRqQS850BZ02iLHYIPa3R5TO6Y9Oir0whZIJ8A/Z1G50M/zY esm99jXc5Bu0WF9WXU//GOvleV/SWXaEmpNMeT5QRmU8XbQGzSPjHPomOMAHJYoJg7y2 EH80zLKZtVwybzPGIPTOkCFGiHn1FOhdAjachu2cZKfONI2TeFLurq5/FCzvT/cSCun/ aLe6sfRqqpymmuKF9xZIqgGvPHdCyKE0YaUbHOJuReQ2vQQminsh7HWBYuF+QJ79dp9+ g57w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=jEMISdzYEmLb2BaVBXTEAaoIyqaVBze0dWitjFYmDz8=; b=WpTiHJfbfpp+mwYG7MnPnI/gimvW3ZaZm979vdEtK3TWZnrlobu4YJLWJD3euBICes REjiWy8wfLbXZ6F0VNRCheQi+/vkJJWhltJXIOHpAtucygU7jhd3Mojra/wnPshOsvhw PS1iTC18tlXTNeydCXGua7T54crayV99pMlNDs6TztCOmxX+50lbNAyVlTzgibL2i7vW ZK+vodTHEciAAS5X33JTo5VBs+wEHRn0zboOv8Cfu5+EnOwTMqFzX4Un++tF76Y+IFva gn82D83pN9ofYMVINwxUWhce56JJdogRIh6b2j7pN8/1jYzoTy8luX78loGjCIF4+7fr lgsg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la20si30693317ejc.3.2021.10.05.21.13.52; Tue, 05 Oct 2021 21:14:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbhJFEMQ (ORCPT + 99 others); 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