mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
mm: remove use of folio list from folios_put()
Instead of putting the interesting folios on a list, delete the uninteresting one from the folio_batch. Link: https://lkml.kernel.org/r/20240227174254.710559-7-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Ryan Roberts <ryan.roberts@arm.com> Cc: David Hildenbrand <david@redhat.com> Cc: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
4882c80975
commit
7c33b8c422
1 changed files with 12 additions and 7 deletions
19
mm/swap.c
19
mm/swap.c
|
@ -961,12 +961,11 @@ void lru_cache_disable(void)
|
||||||
*/
|
*/
|
||||||
void folios_put_refs(struct folio_batch *folios, unsigned int *refs)
|
void folios_put_refs(struct folio_batch *folios, unsigned int *refs)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
LIST_HEAD(pages_to_free);
|
|
||||||
struct lruvec *lruvec = NULL;
|
struct lruvec *lruvec = NULL;
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
|
|
||||||
for (i = 0; i < folios->nr; i++) {
|
for (i = 0, j = 0; i < folios->nr; i++) {
|
||||||
struct folio *folio = folios->folios[i];
|
struct folio *folio = folios->folios[i];
|
||||||
unsigned int nr_refs = refs ? refs[i] : 1;
|
unsigned int nr_refs = refs ? refs[i] : 1;
|
||||||
|
|
||||||
|
@ -1016,14 +1015,20 @@ void folios_put_refs(struct folio_batch *folios, unsigned int *refs)
|
||||||
count_vm_event(UNEVICTABLE_PGCLEARED);
|
count_vm_event(UNEVICTABLE_PGCLEARED);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add(&folio->lru, &pages_to_free);
|
if (j != i)
|
||||||
|
folios->folios[j] = folio;
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
if (lruvec)
|
if (lruvec)
|
||||||
unlock_page_lruvec_irqrestore(lruvec, flags);
|
unlock_page_lruvec_irqrestore(lruvec, flags);
|
||||||
|
if (!j) {
|
||||||
|
folio_batch_reinit(folios);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mem_cgroup_uncharge_list(&pages_to_free);
|
folios->nr = j;
|
||||||
free_unref_page_list(&pages_to_free);
|
mem_cgroup_uncharge_folios(folios);
|
||||||
folio_batch_reinit(folios);
|
free_unref_folios(folios);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(folios_put_refs);
|
EXPORT_SYMBOL(folios_put_refs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue