[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170322063335.GF30149@bbox>
Date: Wed, 22 Mar 2017 15:33:35 +0900
From: Minchan Kim <minchan@...nel.org>
To: Aaron Lu <aaron.lu@...el.com>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...el.com>,
Tim Chen <tim.c.chen@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ying Huang <ying.huang@...el.com>
Subject: Re: [PATCH v2 3/5] mm: use a dedicated workqueue for the free workers
Hi,
On Wed, Mar 15, 2017 at 05:00:02PM +0800, Aaron Lu wrote:
> Introduce a workqueue for all the free workers so that user can fine
> tune how many workers can be active through sysfs interface: max_active.
> More workers will normally lead to better performance, but too many can
> cause severe lock contention.
Let me ask a question.
How well can workqueue distribute the jobs in multiple CPU?
I don't ask about currency but parallelism.
I guess benefit you are seeing comes from the parallelism and
for your goal, unbound wq should spawn a thread per cpu and
doing the work in every each CPU. does it work?
>
> Note that since the zone lock is global, the workqueue is also global
> for all processes, i.e. if we set 8 to max_active, we will have at most
> 8 workers active for all processes that are doing munmap()/exit()/etc.
>
> Signed-off-by: Aaron Lu <aaron.lu@...el.com>
> ---
> mm/memory.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 001c7720d773..19b25bb5f45b 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -253,6 +253,19 @@ static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
> __tlb_reset_range(tlb);
> }
>
> +static struct workqueue_struct *batch_free_wq;
> +static int __init batch_free_wq_init(void)
> +{
> + batch_free_wq = alloc_workqueue("batch_free_wq",
> + WQ_UNBOUND | WQ_SYSFS, 0);
> + if (!batch_free_wq) {
> + pr_warn("failed to create workqueue batch_free_wq\n");
> + return -ENOMEM;
> + }
> + return 0;
> +}
> +subsys_initcall(batch_free_wq_init);
> +
> static void tlb_flush_mmu_free_batches(struct mmu_gather_batch *batch_start,
> bool free_batch_page)
> {
> @@ -306,7 +319,7 @@ static void tlb_flush_mmu_free(struct mmu_gather *tlb)
> batch_free->batch_start = tlb->local.next;
> INIT_WORK(&batch_free->work, batch_free_work);
> list_add_tail(&batch_free->list, &tlb->worker_list);
> - queue_work(system_unbound_wq, &batch_free->work);
> + queue_work(batch_free_wq, &batch_free->work);
>
> tlb->batch_count = 0;
> tlb->local.next = NULL;
> --
> 2.7.4
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
Powered by blists - more mailing lists