Why we Use both mm_users and mm_count in struct mm_struct{ }

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

 



Hi all,
I have been going through the Address Space in the linux and came across two variables in the struct mm_struct and I'm a bit confused about the two:
struct mm_struct
{
              ..........
              atomic_t   mm_users;
              atomic_t   mm_count;
              ............
}
Basically, after reading through I came to understand that mm_users are used to store the number of processes or threads using the memory so depending upon the number of users it is going to be set.
But, I am confused with mm_count, it is said the mm_count is increment by one for all the mm_users and when all the mm_users value is reduced to zero then mm_count is reduced. So, my question is can the value of mm_count be ever greater than one because all the mm_users are equivalent to mm_count . So, if not then why are we using the mm_count as we can simply remove the memory areas whenever the mm_users count reduce to zero.
May be the explanation is simple but I'm lost. Thanking all of you in advance.


Regards,
Niroj Pokhrel
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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