How kernel applies LRU to swap out physical pages? - Kernel

This is a discussion on How kernel applies LRU to swap out physical pages? - 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 ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How kernel applies LRU to swap out physical pages?

  1. How kernel applies LRU to swap out physical pages?

    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
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: How kernel applies LRU to swap out physical pages?

    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.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: How kernel applies LRU to swap out physical pages?

    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



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. Re: How kernel applies LRU to swap out physical pages?

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



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. Re: How kernel applies LRU to swap out physical pages?

    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.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  6. Re: How kernel applies LRU to swap out physical pages?

    Thanks to all, I've have a study.

    2008/11/11 Peter Zijlstra :
    > 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.
    >

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread