Re: PAGE_SHIFT in sys_mlockall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Friday 27 February 2004 15:24, Benoît Lefebvre wrote:
> > Hi,
> >
> > Consider the following lines of code from mlock.c
> >
> > asmlinkage long sys_mlockall(int flags)
> > {
> >         unsigned long lock_limit;
> > ...
> >
> >         lock_limit = current->rlim[RLIMIT_MEMLOCK].rlim_cur;
> >         lock_limit >>= PAGE_SHIFT;
> > ...
> >         if (current->mm->total_vm > lock_limit)
> >                 goto out;
> > ...
> >
> > My question is about "lock_limit >>= PAGE_SHIFT;". I dont understand
> > why this line is needed. Why we cannot just compare rlim_cur with
> > current->mm->total_vm?
>
> If you did, would you not be comparing bytes to pages?

 Yes, you're right. I thought rlim_cur was the maximum number of pages
nonswappable but its the maximum size of nonswappable memory in bytes.
Thanks

>
>
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux