Patch "mm/memcg: fix device private memcg accounting" has been added to the 4.19-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    mm/memcg: fix device private memcg accounting

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-memcg-fix-device-private-memcg-accounting.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7300cbf745a55cabfed7ad7cb7f808f700cbd5f9
Author: Ralph Campbell <rcampbell@xxxxxxxxxx>
Date:   Tue Oct 13 16:53:13 2020 -0700

    mm/memcg: fix device private memcg accounting
    
    [ Upstream commit 9a137153fc8798a89d8fce895cd0a06ea5b8e37c ]
    
    The code in mc_handle_swap_pte() checks for non_swap_entry() and returns
    NULL before checking is_device_private_entry() so device private pages are
    never handled.  Fix this by checking for non_swap_entry() after handling
    device private swap PTEs.
    
    I assume the memory cgroup accounting would be off somehow when moving
    a process to another memory cgroup.  Currently, the device private page
    is charged like a normal anonymous page when allocated and is uncharged
    when the page is freed so I think that path is OK.
    
    Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
    Cc: Michal Hocko <mhocko@xxxxxxxxxx>
    Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
    Cc: Jerome Glisse <jglisse@xxxxxxxxxx>
    Cc: Balbir Singh <bsingharora@xxxxxxxxx>
    Cc: Ira Weiny <ira.weiny@xxxxxxxxx>
    Link: https://lkml.kernel.org/r/20201009215952.2726-1-rcampbell@xxxxxxxxxx
    xFixes: c733a82874a7 ("mm/memcontrol: support MEMORY_DEVICE_PRIVATE")
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index aa730a3d5c258..87cd5bf1b4874 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4780,7 +4780,7 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma,
 	struct page *page = NULL;
 	swp_entry_t ent = pte_to_swp_entry(ptent);
 
-	if (!(mc.flags & MOVE_ANON) || non_swap_entry(ent))
+	if (!(mc.flags & MOVE_ANON))
 		return NULL;
 
 	/*
@@ -4799,6 +4799,9 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma,
 		return page;
 	}
 
+	if (non_swap_entry(ent))
+		return NULL;
+
 	/*
 	 * Because lookup_swap_cache() updates some statistics counter,
 	 * we call find_get_page() with swapper_space directly.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux