on the logic of "try_to_unuse" function in swapfile.c

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

 



hi,
I am recently reading the source code of swapfile.c .
And I came to the logic of try_to_unuse() which try to swap in all
previously swapped pages and re-filling all the corresponding "pte"s.
The comment included in the code has already give some hint on the logic :

        / * When searching mms for an entry, a good strategy is to
	 * start at the first mm we freed the previous entry from
	 * (though actually we don't notice whether we or coincidence
	 * freed the entry).  Initialize this start_mm with a hold.
                  ...    ....

However, I found that the local var "start_mm"  should always equal to
&init_mm through out all   the outer and inner "while" loop:
The only NOT-"&init_mm" assignment to "start_mm" is "start_mm =
new_start_mm;" and in turn the assignments to "new_start_mm" is
"new_start_mm = start_mm;" or "new_start_mm = mm;" but only when "mm
== &init_mm".

Also, "mm","start_mm","new_start_mm" are all local variables, which
means all the possible changes to them are in try_to_unuse().

So, if "start_mm" always equals &init_mm,  why introduce "new_start_mm;" ?

Anyone please help me out, thanks in advance!

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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