LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* How kernel applies LRU to swap out physical pages?
@ 2008-11-11 8:22 Pan ruochen
2008-11-11 8:57 ` Peter Zijlstra
2008-11-11 8:58 ` KOSAKI Motohiro
0 siblings, 2 replies; 6+ messages in thread
From: Pan ruochen @ 2008-11-11 8:22 UTC (permalink / raw)
To: linux-kernel
Hi All,
I'm reading the linux kernel 2.6.14. But can't understand how LRU algorithm
is applied to page swapping. what is the 'USED' of LRU referred to? The
reference counter which the page is mapped by processes, or the frequency that
CPU reads/writes in the page. In common sense, the LRU algorithm will be more
optimal for the second case. But it depends on CPU capability.
I will be very appreciated if somebody can explain that in details.
-------------
Best Regards,
PRC
Nov 11, 2008
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How kernel applies LRU to swap out physical pages?
2008-11-11 8:22 How kernel applies LRU to swap out physical pages? Pan ruochen
@ 2008-11-11 8:57 ` Peter Zijlstra
2008-11-11 9:56 ` KOSAKI Motohiro
2008-11-11 8:58 ` KOSAKI Motohiro
1 sibling, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2008-11-11 8:57 UTC (permalink / raw)
To: Pan ruochen; +Cc: linux-kernel
On Tue, 2008-11-11 at 16:22 +0800, Pan ruochen wrote:
> Hi All,
> I'm reading the linux kernel 2.6.14. But can't understand how LRU algorithm
> is applied to page swapping. what is the 'USED' of LRU referred to? The
> reference counter which the page is mapped by processes, or the frequency that
> CPU reads/writes in the page. In common sense, the LRU algorithm will be more
> optimal for the second case. But it depends on CPU capability.
> I will be very appreciated if somebody can explain that in details.
We don't actually use LRU but something like CLOCK.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How kernel applies LRU to swap out physical pages?
2008-11-11 8:22 How kernel applies LRU to swap out physical pages? Pan ruochen
2008-11-11 8:57 ` Peter Zijlstra
@ 2008-11-11 8:58 ` KOSAKI Motohiro
1 sibling, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2008-11-11 8:58 UTC (permalink / raw)
To: Pan ruochen; +Cc: kosaki.motohiro, linux-kernel
Hi
> Hi All,
> I'm reading the linux kernel 2.6.14.
it seems too old.
I recommend to read newest kernel.
> But can't understand how LRU algorithm
> is applied to page swapping. what is the 'USED' of LRU referred to? The
> reference counter which the page is mapped by processes, or the frequency that
> CPU reads/writes in the page. In common sense, the LRU algorithm will be more
> optimal for the second case. But it depends on CPU capability.
> I will be very appreciated if somebody can explain that in details.
I recommend to read page_referenced() and its related function :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How kernel applies LRU to swap out physical pages?
2008-11-11 8:57 ` Peter Zijlstra
@ 2008-11-11 9:56 ` KOSAKI Motohiro
2008-11-11 11:33 ` Peter Zijlstra
0 siblings, 1 reply; 6+ messages in thread
From: KOSAKI Motohiro @ 2008-11-11 9:56 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: kosaki.motohiro, Pan ruochen, linux-kernel
> On Tue, 2008-11-11 at 16:22 +0800, Pan ruochen wrote:
> > Hi All,
> > I'm reading the linux kernel 2.6.14. But can't understand how LRU algorithm
> > is applied to page swapping. what is the 'USED' of LRU referred to? The
> > reference counter which the page is mapped by processes, or the frequency that
> > CPU reads/writes in the page. In common sense, the LRU algorithm will be more
> > optimal for the second case. But it depends on CPU capability.
> > I will be very appreciated if somebody can explain that in details.
>
> We don't actually use LRU but something like CLOCK.
Yup.
However, VM replace algorithm folks commonly call it to "LRU"
because MACH call so.
IOW, it is historical reason word, shouldn't imazine strict
"Least Recently Used" algorithm.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How kernel applies LRU to swap out physical pages?
2008-11-11 9:56 ` KOSAKI Motohiro
@ 2008-11-11 11:33 ` Peter Zijlstra
2008-11-12 1:36 ` Pan ruochen
0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2008-11-11 11:33 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: Pan ruochen, linux-kernel
On Tue, 2008-11-11 at 18:56 +0900, KOSAKI Motohiro wrote:
> > On Tue, 2008-11-11 at 16:22 +0800, Pan ruochen wrote:
> > > Hi All,
> > > I'm reading the linux kernel 2.6.14. But can't understand how LRU algorithm
> > > is applied to page swapping. what is the 'USED' of LRU referred to? The
> > > reference counter which the page is mapped by processes, or the frequency that
> > > CPU reads/writes in the page. In common sense, the LRU algorithm will be more
> > > optimal for the second case. But it depends on CPU capability.
> > > I will be very appreciated if somebody can explain that in details.
> >
> > We don't actually use LRU but something like CLOCK.
FWIW in case you hadn't found it yet:
http://en.wikipedia.org/wiki/Page_replacement_algorithm
is a fairly decent page on the subject.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How kernel applies LRU to swap out physical pages?
2008-11-11 11:33 ` Peter Zijlstra
@ 2008-11-12 1:36 ` Pan ruochen
0 siblings, 0 replies; 6+ messages in thread
From: Pan ruochen @ 2008-11-12 1:36 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: KOSAKI Motohiro, linux-kernel
Thanks to all, I've have a study.
2008/11/11 Peter Zijlstra <peterz@infradead.org>:
> On Tue, 2008-11-11 at 18:56 +0900, KOSAKI Motohiro wrote:
>> > On Tue, 2008-11-11 at 16:22 +0800, Pan ruochen wrote:
>> > > Hi All,
>> > > I'm reading the linux kernel 2.6.14. But can't understand how LRU algorithm
>> > > is applied to page swapping. what is the 'USED' of LRU referred to? The
>> > > reference counter which the page is mapped by processes, or the frequency that
>> > > CPU reads/writes in the page. In common sense, the LRU algorithm will be more
>> > > optimal for the second case. But it depends on CPU capability.
>> > > I will be very appreciated if somebody can explain that in details.
>> >
>> > We don't actually use LRU but something like CLOCK.
>
> FWIW in case you hadn't found it yet:
>
> http://en.wikipedia.org/wiki/Page_replacement_algorithm
>
> is a fairly decent page on the subject.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-11-12 1:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-11 8:22 How kernel applies LRU to swap out physical pages? Pan ruochen
2008-11-11 8:57 ` Peter Zijlstra
2008-11-11 9:56 ` KOSAKI Motohiro
2008-11-11 11:33 ` Peter Zijlstra
2008-11-12 1:36 ` Pan ruochen
2008-11-11 8:58 ` KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).