[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z6nDmznSoFNDlsvU@localhost.localdomain>
Date: Mon, 10 Feb 2025 10:15:07 +0100
From: Oscar Salvador <osalvador@...e.de>
To: yangge1116@....com
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, 21cnbao@...il.com, david@...hat.com,
baolin.wang@...ux.alibaba.com, aisheng.dong@....com,
liuzixing@...on.cn
Subject: Re: [PATCH V2] mm/cma: using per-CMA locks to improve concurrent
allocation performance
On Mon, Feb 10, 2025 at 09:56:06AM +0800, yangge1116@....com wrote:
> From: yangge <yangge1116@....com>
>
> For different CMAs, concurrent allocation of CMA memory ideally should not
> require synchronization using locks. Currently, a global cma_mutex lock is
> employed to synchronize all CMA allocations, which can impact the
> performance of concurrent allocations across different CMAs.
>
> To test the performance impact, follow these steps:
> 1. Boot the kernel with the command line argument hugetlb_cma=30G to
> allocate a 30GB CMA area specifically for huge page allocations. (note:
> on my machine, which has 3 nodes, each node is initialized with 10G of
> CMA)
> 2. Use the dd command with parameters if=/dev/zero of=/dev/shm/file bs=1G
> count=30 to fully utilize the CMA area by writing zeroes to a file in
> /dev/shm.
> 3. Open three terminals and execute the following commands simultaneously:
> (Note: Each of these commands attempts to allocate 10GB [2621440 * 4KB
> pages] of CMA memory.)
> On Terminal 1: time echo 2621440 > /sys/kernel/debug/cma/hugetlb1/alloc
> On Terminal 2: time echo 2621440 > /sys/kernel/debug/cma/hugetlb2/alloc
> On Terminal 3: time echo 2621440 > /sys/kernel/debug/cma/hugetlb3/alloc
>
> We attempt to allocate pages through the CMA debug interface and use the
> time command to measure the duration of each allocation.
> Performance comparison:
> Without this patch With this patch
> Terminal1 ~7s ~7s
> Terminal2 ~14s ~8s
> Terminal3 ~21s ~7s
>
> To slove problem above, we could use per-CMA locks to improve concurrent
> allocation performance. This would allow each CMA to be managed
> independently, reducing the need for a global lock and thus improving
> scalability and performance.
>
> Signed-off-by: yangge <yangge1116@....com>
Reviewed-by: Oscar Salvador <osalvador@...e.de>
--
Oscar Salvador
SUSE Labs
Powered by blists - more mailing lists