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

Need clarification regarding sharedram in sysinfo()



Hi All,

For system call sysinfo() in linux 2.2.14, it calculates the total
sharedram using si_meminfo(). Here from high_memory i it tries to do the
following
	
	while (i-- > 0)  {
                if (PageReserved(mem_map+i))
                        continue;
                val->totalram++;
                if (!atomic_read(&mem_map[i].count))
                        continue;
                val->sharedram += atomic_read(&mem_map[i].count) - 1;
        }

Here except for the reserved page all the pages increase totalram. And
after that if the value of "atomic_read(&mem_map[i].count)" is zero which
means, I suppose nobody is referencing it, it continues. Otherwise it adds
to the sharedram, for that it does
		val->sharedram += atomic_read(&mem_map[i].count) - 1

What atomic_read(&mem_map[i].count) does is simply reading the 
count which is atomic_t datatype. This value gets increased when the
reference to that page gets increased. So if there are 3 processes which
are accessing the same page the count will be 3. And my understanding is 1
shared page and 3 references here. But here, the way  its calculating the
sharedram is, sharedram += no_of_references -1. Which is slightly
confusing.

So can anybody clarify, what exactly the sharedram supposed to be in this?

Please reply to my id rashmi.agrawal@wipro.com
Regards
Rashmi Agrawal
Wipro Global R & D
Ph : 080-5732296(5236)
=====================

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/