System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

resource limit (max memory) question

SOLVED
Go to solution
Linnartz
Occasional Visitor

resource limit (max memory) question

Hello,

looking at the ulimit -a output it contains the
max memory size (kbytes) 19016312
line. looking at it with a syscall tracer, it looks that this is the RSS resource being used here. If I want to increase it, the documentation states to use the setrlimit (2) call, but I can't seem to use it the suggesteed way. If I use it with a smaller value, the setrlimit call succeeds but when i use larger values, it seems that it doen't get used.

The rss values in vm seem allow 100% and the enforce flag is not set.
/sbin/sysconfig -q vm | grep rss
vm_rss_maxpercent = 100
anon_rss_enforce = 0
vm_rss_block_target = 404
vm_rss_wakeup_target = 404

I haven't found a value in the proc subsystem or the kernel config file.

many thanks in advance for any help
Pit


#include
#include


int main(int argc, char *argv[])
{
struct rlimit rl;
unsigned long data_val;
unsigned long max_rss;
unsigned long cur_rss;
int res;

res = getrlimit ( RLIMIT_RSS, &rl );
if (res == 0) {
printf("RSS %ld %ld \n", rl.rlim_cur, rl.rlim_max);
}else{
printf(" RSS getrlimit errno %d\n", errno);
}
max_rss = rl.rlim_max;
cur_rss = rl.rlim_cur;
res = getrlimit ( RLIMIT_DATA, &rl );
if (res == 0) {
printf("DATA %ld %ld \n", rl.rlim_cur, rl.rlim_max);
}else{
printf(" DATA getrlimit errno %d\n", errno);
}
data_val = rl.rlim_cur;

/*
rl.rlim_cur = cur_rss - 1000;
rl.rlim_max = cur_rss;
*/
rl.rlim_cur = data_val;
res = setrlimit ( RLIMIT_RSS, &rl );
if (res == 0) {
printf("set RSS %ld %ld \n", rl.rlim_cur, rl.rlim_max);
}else{
printf(" RSS setrlimit errno %d\n", errno);
}

res = getrlimit ( RLIMIT_RSS, &rl );
if (res == 0) {
printf("RSS %ld %ld \n", rl.rlim_cur, rl.rlim_max);
}else{
printf(" RSS getrlimit errno %d\n", errno);
}

}

4 REPLIES
Linnartz
Occasional Visitor

Re: resource limit (max memory) question

oops,

perhaps it's worthwhile to apply a bit background. some people asked me how to increase this value. I resonded via
ulimit -m unlimited
but they said the value wouldn't change. They claim that this parameter is the only difference when compared with another machine, and due to this must be the culprit for achieving less performance in memory intensive work. Even I didn't believe it in first place, I failed to increase this value resulting in the former message/question.
jim owens_1
Valued Contributor
Solution

Re: resource limit (max memory) question

The output of /usr/bin/ulimit -m or -a that says memory(kbytes) is physical machine memory.

They can change it if they purchase more DRAM.

I would not be surprised a memory-intensize application runs better with more memory in the system.


Linnartz
Occasional Visitor

Re: resource limit (max memory) question

Jim,

many thanks for the answer. Being able to read sometimes seems advantageous :-(

one minor issue is how to calculate this number out of the vmstat -P output, especially if gh is in use.
jim owens_1
Valued Contributor

Re: resource limit (max memory) question

For an excellent discussion of the calculation, see:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1080328

You need to provide details of the 2 systems and the quantified performance difference to get good help.