From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A13FA0C4B; Tue, 9 Nov 2021 02:59:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E0F740E03; Tue, 9 Nov 2021 02:59:25 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6989140687 for ; Tue, 9 Nov 2021 02:59:24 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1059) id A543520ABAF3; Mon, 8 Nov 2021 17:59:23 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A543520ABAF3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1636423163; bh=ftu9+7RDRkPypLPnCDlhTgoLrbyxlU5r+Wxzv+yzrrE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g8ReNIklQQaB7lr8rKk63NSc9GRPjtN4xsYDmL9Wm1BOKvnaPDxkWF8Jp5SFFo7em q3/h0QA7Jn1RegwlXGBUeeqvDuklJNt1jGX7TlMnxGr75krJyCH78IsN+vgswZKDhC 9/kO3dmW08nfVb6Mq6doD6rHey+2rm44/qFs/h5g= Date: Mon, 8 Nov 2021 17:59:23 -0800 From: Narcisa Ana Maria Vasile To: Thomas Monjalon Cc: dev@dpdk.org, dmitry.kozliuk@gmail.com, khot@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Message-ID: <20211109015923.GB12569@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1633732841-17873-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-3-git-send-email-navasile@linux.microsoft.com> <11591275.oo6G3FHbOz@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11591275.oo6G3FHbOz@thomas> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v16 2/9] eal: add thread attributes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 12, 2021 at 06:12:21PM +0200, Thomas Monjalon wrote: > 09/10/2021 09:41, Narcisa Ana Maria Vasile: > > From: Narcisa Vasile > > > > Implement thread attributes for: > > * thread affinity > > * thread priority > > Implement functions for managing thread attributes. > > > > Priority is represented through an enum that allows for two levels: > > - RTE_THREAD_PRIORITY_NORMAL > > - RTE_THREAD_PRIORITY_REALTIME_CRITICAL > > It doesn't say how do you translate these priorites in POSIX and win32. I'll send a new version with a better commit message. Thread priorities on both Linux-based and Windows platforms are similarly constructed from a class/policy + priority value. Currently in DPDK, most threads operate at the OS-default priority level but there are cases when increasing the priority is useful. For example, the Mellanox data path acceleration driver requires realtime thread priority. Similarly, some Windows applications will require elevated priority. For these reasons, EAL will advertise 2 priority levels which are named suggestively "normal" and "realtime_critical" and are computed as follows: For Linux and similar platforms: * EAL "normal" priority corresponds to the (default) SCHED_OTHER policy + a priority value of (sched_get_priority_min(SCHED_OTHER) + sched_get_priority_max(SCHED_OTHER))/2. Note that on Linux the resulting priority value will be 0, in accordance to the docs guidance that mention the value should be 0 for SCHED_OTHER policy. * EAL "realtime" priority corresponds to the SCHED_RR policy + a priority value of sched_get_priority_max(SCHED_RR); For Windows: * EAL "normal" corresponds to class NORMAL_PRIORITY_CLASS + priority THREAD_PRIORITY_NORMAL * EAL "realtime_critical" corresponds to class REALTIME_PRIORITY_CLASS + priority THREAD_PRIORITY_TIME_CRITICAL > > > Affinity is described by the rte_cpuset_t type. > > > > An rte_thread_attr_t object can be set to the default values > > by calling rte_thread_attr_init(). > > > > Signed-off-by: Narcisa Vasile > [...] > > lib/eal/common/rte_thread.c | 46 ++++++++++++++++++ > > lib/eal/windows/rte_thread.c | 44 +++++++++++++++++ > > These 2 files look like code duplication. > >