linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	Dave Chinner <david@fromorbit.com>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Baoquan He <bhe@redhat.com>, David Hildenbrand <david@redhat.com>,
	Liu Shixin <liushixin2@huawei.com>, Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH v2 2/4] mm: vmalloc: use rwsem, mutex for vmap_area_lock and vmap_block->lock
Date: Wed, 22 Mar 2023 19:01:59 +0100	[thread overview]
Message-ID: <ZBtCl34dolg2YE+3@pc636> (raw)
In-Reply-To: <ZBs/MGH+xUAZXNTz@casper.infradead.org>

On Wed, Mar 22, 2023 at 05:47:28PM +0000, Matthew Wilcox wrote:
> On Wed, Mar 22, 2023 at 02:18:19PM +0100, Uladzislau Rezki wrote:
> > Hello, Dave.
> > 
> > > 
> > > I'm travelling right now, but give me a few days and I'll test this
> > > against the XFS workloads that hammer the global vmalloc spin lock
> > > really, really badly. XFS can use vm_map_ram and vmalloc really
> > > heavily for metadata buffers and hit the global spin lock from every
> > > CPU in the system at the same time (i.e. highly concurrent
> > > workloads). vmalloc is also heavily used in the hottest path
> > > throught the journal where we process and calculate delta changes to
> > > several million items every second, again spread across every CPU in
> > > the system at the same time.
> > > 
> > > We really need the global spinlock to go away completely, but in the
> > > mean time a shared read lock should help a little bit....
> > > 
> > Could you please share some steps how to run your workloads in order to
> > touch vmalloc() code. I would like to have a look at it in more detail
> > just for understanding the workloads.
> > 
> > Meanwhile my grep agains xfs shows:
> > 
> > <snip>
> > urezki@pc638:~/data/raid0/coding/linux-rcu.git/fs/xfs$ grep -rn vmalloc ./
> 
> You're missing:
> 
> fs/xfs/xfs_buf.c:                       bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count,
> 
> which i suspect is the majority of Dave's workload.  That will almost
> certainly take the vb_alloc() path.
>
Then it has nothing to do with vmalloc contention(i mean global KVA allocator), IMHO.
Unless:

<snip>
void *vm_map_ram(struct page **pages, unsigned int count, int node)
{
	unsigned long size = (unsigned long)count << PAGE_SHIFT;
	unsigned long addr;
	void *mem;

	if (likely(count <= VMAP_MAX_ALLOC)) {
		mem = vb_alloc(size, GFP_KERNEL);
		if (IS_ERR(mem))
			return NULL;
		addr = (unsigned long)mem;
	} else {
		struct vmap_area *va;
		va = alloc_vmap_area(size, PAGE_SIZE,
				VMALLOC_START, VMALLOC_END, node, GFP_KERNEL);
		if (IS_ERR(va))
			return NULL;
<snip>

number of pages > VMAP_MAX_ALLOC.

That is why i have asked about workloads because i would like to understand
where a "problem" is. A vm_map_ram() access the global vmap space but it happens 
when a new vmap block is required and i also think it is not a problem.

But who knows, therefore it makes sense to have a lock at workload.

--
Uladzislau Rezki

  reply	other threads:[~2023-03-22 18:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19  7:09 [PATCH v2 0/4] convert read_kcore(), vread() to use iterators Lorenzo Stoakes
2023-03-19  7:09 ` [PATCH v2 1/4] fs/proc/kcore: Avoid bounce buffer for ktext data Lorenzo Stoakes
2023-03-20  9:58   ` David Hildenbrand
2023-03-19  7:09 ` [PATCH v2 2/4] mm: vmalloc: use rwsem, mutex for vmap_area_lock and vmap_block->lock Lorenzo Stoakes
2023-03-19 20:10   ` Andrew Morton
2023-03-19 20:29     ` Lorenzo Stoakes
2023-03-19 20:47       ` Matthew Wilcox
2023-03-19 21:16         ` Lorenzo Stoakes
2023-03-20  8:40           ` Lorenzo Stoakes
2023-03-20  7:54   ` Uladzislau Rezki
2023-03-20  8:25     ` Lorenzo Stoakes
2023-03-20  8:32       ` Uladzislau Rezki
2023-03-20  8:35         ` Lorenzo Stoakes
2023-03-20 11:20           ` Uladzislau Rezki
2023-03-21  1:09   ` Dave Chinner
2023-03-21  5:23     ` Uladzislau Rezki
2023-03-21  7:45       ` Lorenzo Stoakes
2023-03-21  8:54         ` Uladzislau Rezki
2023-03-21 10:05         ` Dave Chinner
2023-03-21 10:24           ` Uladzislau Rezki
2023-03-22 13:18     ` Uladzislau Rezki
2023-03-22 17:47       ` Matthew Wilcox
2023-03-22 18:01         ` Uladzislau Rezki [this message]
2023-03-22 19:15           ` Uladzislau Rezki
2023-03-23 12:47             ` Uladzislau Rezki
2023-03-24  5:25       ` Dave Chinner
2023-03-24  5:31         ` Matthew Wilcox
2023-03-27  0:38           ` Dave Chinner
2023-03-27 17:22         ` Uladzislau Rezki
2023-03-28  2:53           ` Dave Chinner
2023-03-28 12:40             ` Uladzislau Rezki
2023-03-19  7:09 ` [PATCH v2 3/4] fs/proc/kcore: convert read_kcore() to read_kcore_iter() Lorenzo Stoakes
2023-03-19  7:09 ` [PATCH v2 4/4] mm: vmalloc: convert vread() to vread_iter() Lorenzo Stoakes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBtCl34dolg2YE+3@pc636 \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=david@fromorbit.com \
    --cc=david@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=lstoakes@gmail.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).