lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 6/9] mm/workingset: handle the page without memcg
    Date
    From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

    When implementing workingset detection for anonymous page, I found
    some swapcache pages with NULL memcg. From the code reading, I found
    two reasons.

    One is the case that swap-in readahead happens. The other is the
    corner case related to the shmem cache. These two problems should be
    fixed, but, it's not straight-forward to fix. For example, when swap-off,
    all swapped-out pages are read into swapcache. In this case, who's the
    owner of the swapcache page?

    Since this problem doesn't look trivial, I decide to leave the issue and
    handles this corner case on the place where the error occurs.

    Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    ---
    mm/workingset.c | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/mm/workingset.c b/mm/workingset.c
    index a9f474a..8d2e83a 100644
    --- a/mm/workingset.c
    +++ b/mm/workingset.c
    @@ -257,6 +257,10 @@ void *workingset_eviction(struct page *page, struct mem_cgroup *target_memcg)
    VM_BUG_ON_PAGE(page_count(page), page);
    VM_BUG_ON_PAGE(!PageLocked(page), page);

    + /* page_memcg() can be NULL if swap-in readahead happens */
    + if (!page_memcg(page))
    + return NULL;
    +
    advance_inactive_age(page_memcg(page), pgdat, is_file);

    lruvec = mem_cgroup_lruvec(target_memcg, pgdat);
    --
    2.7.4
    \
     
     \ /
      Last update: 2020-03-17 06:43    [W:3.861 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site