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?



--
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