linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Haws <jhaws@sdl.usu.edu>
To: "kevin.dankwardt@gmail.com" <kevin.dankwardt@gmail.com>
Cc: "linux-embedded@vger.kernel.org" <linux-embedded@vger.kernel.org>
Subject: Re: POSIX Message Queue Priority Scheduling
Date: Tue, 14 Nov 2017 23:29:05 +0000	[thread overview]
Message-ID: <1510702145.3005.41.camel@sdl.usu.edu> (raw)
In-Reply-To: <1510340694.15160.7.camel@sdl.usu.edu>


> Yeah - I was looking at that code and was having a hard time
> following
> it.  It appears to me that if the queue is full, it goes into this
> wq_sleep(), but then never comes back to post - however it has to
> come
> back at some point when it wakes.  The wq_sleep() function calls
> wq_add
> which appears to add in priority order, however it uses static_prio
> of
> the task_struct.
> 
> Looking at task_struct, there are four priorities defined --
> 
> 	int prio, static_prio, normal_prio;
> 	unsigned int rt_priority;
> 
> What I'd like to know is the details of what each of those mean.  It
> seems that if the static_prio of each thread is the same, even if the
> rt_priority is different, they would wake in FIFO order (since all
> static_prios are equal).  Some searching doesn't quite answer the
> question fully.  Does the message queue implementation ignore the
> fact
> that some threads are RT threads?  It sure seems to...

Did a lot more digging and found the following, which I'll post here
for reference.

prio - holds the actual priority in use (after priority boosting/RT
considerations/etc.) of the process or thread

static_prio - holds the static priority (based on niceness) of the
process or thread

normal_prio - holds the dynamic priority of the process or thread.  In
the testing I did this always equaled prio, but this isn't necessarily
always the case

rt_priority - holds the user-specified RT priority of the thread and
plays into the prio value if using a RT scheduler (such as SCHED_FIFO
or SCHED_RR).


I made a simple change to the ipc/mqueue.c:wq_add() routine.  I changed
static_prio to prio in the if statement comparing priorities.  This was
all it took.

I'm working on getting that change into mainline, but hopefully this
thread on this list will be of help to someone else.

Thanks all!

      reply	other threads:[~2017-11-14 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 15:32 POSIX Message Queue Priority Scheduling Jonathan Haws
     [not found] ` <CAJUC52E3gsjSzdkvJD+gL8WSp93ZtabhShX_BHBZJRLDYWZbAg@mail.gmail.com>
2017-10-31 16:49   ` Jonathan Haws
2017-11-10  2:34   ` Jonathan Haws
     [not found]     ` <5C01B066-EEC2-4D24-B9E6-D6E6AF8BF212@gmail.com>
     [not found]       ` <1510281787.2403.14.camel@sdl.usu.edu>
     [not found]         ` <E100FFF7-7D54-4296-83CF-0950BEE222DB@gmail.com>
     [not found]           ` <1510283635.2403.18.camel@sdl.usu.edu>
     [not found]             ` <CAJUC52HYx1pWt9iHFN6Lc0-SB6wA2zBxX9nQYxzPh+R7tqdVgw@mail.gmail.com>
2017-11-10 19:04               ` Jonathan Haws
2017-11-14 23:29                 ` Jonathan Haws [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510702145.3005.41.camel@sdl.usu.edu \
    --to=jhaws@sdl.usu.edu \
    --cc=kevin.dankwardt@gmail.com \
    --cc=linux-embedded@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).