Re: RLIMIT_AS maximum is 2GB

Scott Lurndal (slurn@griffin.engr.sgi.com)
Fri, 5 Mar 1999 13:51:52 -0800 (PST)


In article <7biehb$a8uch@fido.engr.sgi.com>, you write:
|> With all the discussion about the tradeoff between physical memory
|> size and maximum virtual memory size awhile back, I was surprised to
|> find that the RLIMIT_AS (address space) limit is about 2GB,
|> and it doesn't seem possible for a process to get more VM than that.
|>
|> The essence of the problem is that the rlimit_cur and rlimit_max
|> members of struct rlimit are simply type "long" and for size-oriented
|> limits (like RLIMIT_AS) they count bytes. So, the most you can have
|> is 0x7fffffff. So my questions:
|>
|> 1) Am I missing something?

Yes. Linux has a broken get/setrlimit() interface; it is specified
in other systems and in the XPG4.2 and XPG5 standards as an
unsigned integral type.

|>
|> 2) Is there a solution for machines where sizeof(long)==4?
|>
|> One approach would be to make RLIMIT_AS work in units of KB.
|> The only objection I can think of, is that it would then differ
|> from the other size-oriented limits, and that would be a bad thing.

Fix <include/linux/resource.h>:

*** /tmp/r.h Fri Mar 5 13:46:54 1999
--- /tmp/r1.h Fri Mar 5 13:47:38 1999
***************
*** 37,47 ****
long ru_nivcsw; /* involuntary " */
};

! #define RLIM_INFINITY ((long)(~0UL>>1))

struct rlimit {
! long rlim_cur;
! long rlim_max;
};

#define PRIO_MIN (-20)
--- 37,50 ----
long ru_nivcsw; /* involuntary " */
};

!
! typedef unsigned long rlim_t;
!
! #define RLIM_INFINITY ((rlim_t)(~0UL>>1))

struct rlimit {
! rlim_t rlim_cur;
! rlim_t rlim_max;
};

#define PRIO_MIN (-20)

---

Note that there are additional changes required for the LFS stuff (rlim64_t, etc).

scott lurndal silicon graphics, inc. (I speak for myself)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/