Unverified Commit 078c31df authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7047 backport patch for thp deferred list

Merge Pull Request from: @ci-robot 
 
PR sync from: Wupeng Ma <mawupeng1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/HNDBJOVREGHSBG2D4BIAD52W7BLPNWBK/ 
From: Ma Wupeng <mawupeng1@huawei.com>

backport patch for thp deferred list.

Jianxing Wang (1):
  mm/mmu_gather: limit free batch count and add schedule point in
    tlb_batch_pages_flush

Yin Fengwei (1):
  THP: avoid lock when check whether THP is in deferred list


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I9NU9F 
 
Link:https://gitee.com/openeuler/kernel/pulls/7047

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents d7798afd fe577051
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -2811,12 +2811,19 @@ void free_transhuge_page(struct page *page)
	struct deferred_split *ds_queue = get_deferred_split_queue(page);
	unsigned long flags;

	/*
	 * At this point, there is no one trying to add the folio to
	 * deferred_list. If folio is not in deferred_list, it's safe
	 * to check without acquiring the split_queue_lock.
	 */
	if (data_race(!list_empty(page_deferred_list(page)))) {
		spin_lock_irqsave(&ds_queue->split_queue_lock, flags);
		if (!list_empty(page_deferred_list(page))) {
			ds_queue->split_queue_len--;
			list_del(page_deferred_list(page));
		}
		spin_unlock_irqrestore(&ds_queue->split_queue_lock, flags);
	}
	free_compound_page(page);
}

+14 −2
Original line number Diff line number Diff line
@@ -46,8 +46,20 @@ static void tlb_batch_pages_flush(struct mmu_gather *tlb)
	struct mmu_gather_batch *batch;

	for (batch = &tlb->local; batch && batch->nr; batch = batch->next) {
		free_pages_and_swap_cache(batch->pages, batch->nr);
		batch->nr = 0;
		struct page **pages = batch->pages;

		do {
			/*
			 * limit free batch count when PAGE_SIZE > 4K
			 */
			unsigned int nr = min(512U, batch->nr);

			free_pages_and_swap_cache(pages, nr);
			pages += nr;
			batch->nr -= nr;

			cond_resched();
		} while (batch->nr);
	}
	tlb->active = &tlb->local;
}