mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 18:23:53 +08:00
mm/memcg: Add folio_lruvec()
This replaces mem_cgroup_page_lruvec(). All callers converted. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: David Howells <dhowells@redhat.com> Acked-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
fcce4672c0
commit
b1baabd995
@ -784,18 +784,17 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mem_cgroup_page_lruvec - return lruvec for isolating/putting an LRU page
|
* folio_lruvec - return lruvec for isolating/putting an LRU folio
|
||||||
* @page: the page
|
* @folio: Pointer to the folio.
|
||||||
*
|
*
|
||||||
* This function relies on page->mem_cgroup being stable.
|
* This function relies on folio->mem_cgroup being stable.
|
||||||
*/
|
*/
|
||||||
static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page)
|
static inline struct lruvec *folio_lruvec(struct folio *folio)
|
||||||
{
|
{
|
||||||
pg_data_t *pgdat = page_pgdat(page);
|
struct mem_cgroup *memcg = folio_memcg(folio);
|
||||||
struct mem_cgroup *memcg = page_memcg(page);
|
|
||||||
|
|
||||||
VM_WARN_ON_ONCE_PAGE(!memcg && !mem_cgroup_disabled(), page);
|
VM_WARN_ON_ONCE_FOLIO(!memcg && !mem_cgroup_disabled(), folio);
|
||||||
return mem_cgroup_lruvec(memcg, pgdat);
|
return mem_cgroup_lruvec(memcg, folio_pgdat(folio));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
|
struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
|
||||||
@ -1256,10 +1255,9 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
|
|||||||
return &pgdat->__lruvec;
|
return &pgdat->__lruvec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page)
|
static inline struct lruvec *folio_lruvec(struct folio *folio)
|
||||||
{
|
{
|
||||||
pg_data_t *pgdat = page_pgdat(page);
|
struct pglist_data *pgdat = folio_pgdat(folio);
|
||||||
|
|
||||||
return &pgdat->__lruvec;
|
return &pgdat->__lruvec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
|
|||||||
if (!TestClearPageLRU(page))
|
if (!TestClearPageLRU(page))
|
||||||
goto isolate_fail_put;
|
goto isolate_fail_put;
|
||||||
|
|
||||||
lruvec = mem_cgroup_page_lruvec(page);
|
lruvec = folio_lruvec(page_folio(page));
|
||||||
|
|
||||||
/* If we already hold the lock, we can skip some rechecking */
|
/* If we already hold the lock, we can skip some rechecking */
|
||||||
if (lruvec != locked) {
|
if (lruvec != locked) {
|
||||||
|
@ -1154,9 +1154,10 @@ void lruvec_memcg_debug(struct lruvec *lruvec, struct page *page)
|
|||||||
*/
|
*/
|
||||||
struct lruvec *lock_page_lruvec(struct page *page)
|
struct lruvec *lock_page_lruvec(struct page *page)
|
||||||
{
|
{
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
struct lruvec *lruvec;
|
struct lruvec *lruvec;
|
||||||
|
|
||||||
lruvec = mem_cgroup_page_lruvec(page);
|
lruvec = folio_lruvec(folio);
|
||||||
spin_lock(&lruvec->lru_lock);
|
spin_lock(&lruvec->lru_lock);
|
||||||
|
|
||||||
lruvec_memcg_debug(lruvec, page);
|
lruvec_memcg_debug(lruvec, page);
|
||||||
@ -1166,9 +1167,10 @@ struct lruvec *lock_page_lruvec(struct page *page)
|
|||||||
|
|
||||||
struct lruvec *lock_page_lruvec_irq(struct page *page)
|
struct lruvec *lock_page_lruvec_irq(struct page *page)
|
||||||
{
|
{
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
struct lruvec *lruvec;
|
struct lruvec *lruvec;
|
||||||
|
|
||||||
lruvec = mem_cgroup_page_lruvec(page);
|
lruvec = folio_lruvec(folio);
|
||||||
spin_lock_irq(&lruvec->lru_lock);
|
spin_lock_irq(&lruvec->lru_lock);
|
||||||
|
|
||||||
lruvec_memcg_debug(lruvec, page);
|
lruvec_memcg_debug(lruvec, page);
|
||||||
@ -1178,9 +1180,10 @@ struct lruvec *lock_page_lruvec_irq(struct page *page)
|
|||||||
|
|
||||||
struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags)
|
struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags)
|
||||||
{
|
{
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
struct lruvec *lruvec;
|
struct lruvec *lruvec;
|
||||||
|
|
||||||
lruvec = mem_cgroup_page_lruvec(page);
|
lruvec = folio_lruvec(folio);
|
||||||
spin_lock_irqsave(&lruvec->lru_lock, *flags);
|
spin_lock_irqsave(&lruvec->lru_lock, *flags);
|
||||||
|
|
||||||
lruvec_memcg_debug(lruvec, page);
|
lruvec_memcg_debug(lruvec, page);
|
||||||
|
@ -293,7 +293,8 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
|
|||||||
|
|
||||||
void lru_note_cost_page(struct page *page)
|
void lru_note_cost_page(struct page *page)
|
||||||
{
|
{
|
||||||
lru_note_cost(mem_cgroup_page_lruvec(page),
|
struct folio *folio = page_folio(page);
|
||||||
|
lru_note_cost(folio_lruvec(folio),
|
||||||
page_is_file_lru(page), thp_nr_pages(page));
|
page_is_file_lru(page), thp_nr_pages(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,6 +397,7 @@ out:
|
|||||||
*/
|
*/
|
||||||
void workingset_activation(struct page *page)
|
void workingset_activation(struct page *page)
|
||||||
{
|
{
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
struct mem_cgroup *memcg;
|
struct mem_cgroup *memcg;
|
||||||
struct lruvec *lruvec;
|
struct lruvec *lruvec;
|
||||||
|
|
||||||
@ -411,7 +412,7 @@ void workingset_activation(struct page *page)
|
|||||||
memcg = page_memcg_rcu(page);
|
memcg = page_memcg_rcu(page);
|
||||||
if (!mem_cgroup_disabled() && !memcg)
|
if (!mem_cgroup_disabled() && !memcg)
|
||||||
goto out;
|
goto out;
|
||||||
lruvec = mem_cgroup_page_lruvec(page);
|
lruvec = folio_lruvec(folio);
|
||||||
workingset_age_nonresident(lruvec, thp_nr_pages(page));
|
workingset_age_nonresident(lruvec, thp_nr_pages(page));
|
||||||
out:
|
out:
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user