← Back to team overview

maria-discuss team mailing list archive

Re: mariadb runs at lowest priority (nice -n 19) - PBXT code causing problems

 


On Jun 6, 2011, at 11:23 AM, Michael Widenius wrote:


Hi!

"Paul" == Paul McCullagh <paul.mccullagh@xxxxxxxxxxxxx> writes:

Paul> The intension of this code was to set the priority of the current
Paul> running thread only, not the entire program.

Paul> If the code is not working in this manner, then there is no better
Paul> solution that to disable it.

Paul> However it would be nice in the cases where pthread_setschedparam()
Paul> does work, that it is called.

Agree, but I don't know how to test for this case :(
At least on linux, using setpriority() will not work with any modern Linux.

Paul> In the current code, pthread_setschedparam() is called when
Paul> pth_min_priority != pth_max_priority.

Current code ?

Do you mean that this has been changed recently ?

No, this has not been changed in years.

(It was not a long time ago when we merged with the latest pbxt, so I
assumed we have the latest code already).

The pbxt code in the MariaDB tree is bascily:
(from xt_p_set_low_priority()):

if (pth_min_priority == pth_max_priority)
setpriority()
else
pth_set_priority()

It's the call to setpriority() that should be avoided in all cases.

Don't see how to fix this for linux except by adding an ifdef around
the call to setpriority().


Do you know of any system, except old obsolete linux systems, where one should
use setpriority() to set the priority for a thread?

I have done no research on this, so I think we should simply change the code to:

 if (pth_min_priority != pth_max_priority)
    pth_set_priority()

This would mean the thread priority is not changed, but that better than mistakingly changing the program priority.



--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com





Follow ups

References