From 135e9232530986169760cc2fc71fff8581f0e4be Mon Sep 17 00:00:00 2001 From: Hongbo Yao Date: Wed, 14 Aug 2019 11:10:20 +0800 Subject: [PATCH] ktask: change the chunk size for some ktask thread functions hulk inclusion category: feature bugzilla: 13228 CVE: NA --------------------------- This patch fixes some issue in original series. 1) PMD_SIZE chunks have made thread finishing times too spread out in some cases, so KTASK_MEM_CHUNK(128M) seems to be a reasonable compromise 2) If hugepagesz=1G, then pages_per_huge_page = 1G / 4K = 256, use KTASK_MEM_CHUNK will cause the ktask thread to be 1, which will not improve the performance of clear gigantic page. Signed-off-by: Hongbo Yao Reviewed-by: Xie XiuQi Tested-by: Hongbo Yao Signed-off-by: Yang Yingliang --- drivers/vfio/vfio_iommu_type1.c | 2 +- mm/memory.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 943c41eef74a..414bb2e8c7bd 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1120,7 +1120,7 @@ static int vfio_pin_map_dma(struct vfio_iommu *iommu, struct vfio_dma *dma, int ret = 0; struct vfio_pin_args args = { iommu, dma, limit, current->mm }; /* Stay on PMD boundary in case THP is being used. */ - DEFINE_KTASK_CTL(ctl, vfio_pin_map_dma_chunk, &args, PMD_SIZE); + DEFINE_KTASK_CTL(ctl, vfio_pin_map_dma_chunk, &args, KTASK_MEM_CHUNK); ktask_ctl_set_undo_func(&ctl, vfio_pin_map_dma_undo); ret = ktask_run((void *)dma->vaddr, map_size, &ctl); diff --git a/mm/memory.c b/mm/memory.c index b9b85b3b0874..a5433be46cdc 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4489,7 +4489,7 @@ void clear_huge_page(struct page *page, struct ktask_node node = {0, pages_per_huge_page, page_to_nid(page)}; DEFINE_KTASK_CTL(ctl, clear_gigantic_page_chunk, &args, - KTASK_MEM_CHUNK); + KTASK_PTE_MINCHUNK); ktask_run_numa(&node, 1, &ctl); return; -- GitLab