Project

General

Profile

Increase POSIX message queue size

Added by Mladen Kerep about 8 years ago

I've rebuild the linux kernel acc. Building the Linux Kernel Wiki and enabled the POSIX Message queues by setting the kernel config parameter CONFIG_POSIX_MQUEUE=y. The kernel build and installed successfully on the board.

In order to increase corresponding queue defaults, we do the following:

add following lines to /etc/security/limits.conf just before '# End of file'

!* soft nofile 65536
!* hard nofile 65536
!* soft msgqueue 8032000
!* hard msgqueue 8032000

add the following lines at end of /etc/sysctl.conf

kernel.msgmax=8192
kernel.msgmni=1655
#Increase the msgq size to 10MB from 16K
kernel.msgmnb=10485760

add the following lines at end of /etc/pam.d/common-session

session required pam_limits.so

After rebooting, however, 'ulimit -a' still lists the default message queue size as:

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31458
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31458
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

So none of our system modifications above did take effect :(
I had to modify directly include/uapi/linux/mqueue.h
#define MQ_BYTES_MAX 8032000

The message queues function as expected.

My questions is, however, why are the settings not considered by the system ?
We're running Ubuntu 14.04 LTS (kernel 3.13) with all this settings working, without having to modify the kernel sources.


Replies (7)

RE: Increase POSIX message queue size - Added by Daniel Vincelette about 8 years ago

Hello,

One quick question, are the ! before the * meant to be there?

I will try to reproduce this issue tomorrow, I'll report back once I do.

Dan

RE: Increase POSIX message queue size - Added by Mladen Kerep about 8 years ago

No, '!' are my faults, ie. due to my poor knowledge about formatting.
The lines start with '*', but then text formatting makes lists out of that :-/
(maybe you could re-edit?)
Mladen

RE: Increase POSIX message queue size - Added by Michael Williamson about 8 years ago

FYI: In this particular web app, you can escape / quote code using the "pre" or the "code" HTML tag e.g.:

pre tag:

* 1 2 3

code tag:
* 1 2 3

Click the "text formatting" link in the toolbar to see additional info. I think Dan was looking into using the lines without the exclamation points last night. Hopefully we'll get to the bottom of it.

-Mike

RE: Increase POSIX message queue size - Added by Daniel Vincelette about 8 years ago

I was able to recreate this issue. It looks like pam wasn't enabled in the yocto build when the file system was built, more information about enabling it can be found here: https://wiki.yoctoproject.org/wiki/PAM_Integration

I was able to increase the queue limit by using ulimit -q, though I don't know if that is acceptable for your application.

root@mitysom-5csx:~# ulimit -q 8032000
root@mitysom-5csx:~# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8058
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 8032000
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8058
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Dan

RE: Increase POSIX message queue size - Added by Mladen Kerep about 8 years ago

I was able to recreate this issue. It looks like pam wasn't enabled in the yocto build when the file system was built, more information about enabling it can be found here: https://wiki.yoctoproject.org/wiki/PAM_Integration

I'll take a look at that once I'm familiar with rebuilding the file system using yocto.
For now I'm simply trying to follow the wiki instructions to do that but failing accessing repositories with the git protocol (git://), ref. thread Accessing git repositories when behind firewall

I was able to increase the queue limit by using ulimit -q, though I don't know if that is acceptable for your application.

That's an option if one has access to the system to issue the command remotely ... once the system has booted up completely.
Unfortunately, that's not always the case for our project.

Thanks
Mladen

RE: Increase POSIX message queue size - Added by Daniel Vincelette about 8 years ago

Understood, our IT department is still currently working on seeing what is going on with the certs

Just a suggestion: you could add a startup script that does the ulimit -q on startup so every time the system is booted the limit is set to the higher value.

Dan

RE: Increase POSIX message queue size - Added by Mladen Kerep about 8 years ago

Just a suggestion: you could add a startup script that does the ulimit -q on startup so every time the system is booted the limit is set to the higher value.

Yes, sure, I know this.
But for now, I prefer modifying the kernel:

include/uapi/linux/mqueue.h
#define MQ_BYTES_MAX 8032000

Mladen

    (1-7/7)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)