linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: <hailong.liu@oppo.com>
Cc: <urezki@gmail.com>, <hch@infradead.org>, <lstoakes@gmail.com>,
	<21cnbao@gmail.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <xiang@kernel.org>,
	<guangye.yang@mediatek.com>, <zhaoyang.huang@unisoc.com>,
	"Hailong . Liu" <liuhailong@oppo.com>
Subject: Re: [RFC PATCH] mm/vmalloc: fix vbq->free breakage
Date: Thu, 30 May 2024 13:05:41 -0700	[thread overview]
Message-ID: <20240530130541.c615fcfc1e6f211199315e13@linux-foundation.org> (raw)
In-Reply-To: <20240530093108.4512-1-hailong.liu@oppo.com>

On Thu, 30 May 2024 17:31:08 +0800 <hailong.liu@oppo.com> wrote:

> From: "hailong.liu" <hailong.liu@oppo.com>
> 
> The function xa_for_each() in _vm_unmap_aliases() loops through all
> vbs. However, since commit 062eacf57ad9 ("mm: vmalloc: remove a global
> vmap_blocks xarray") the vb from xarray may not be on the corresponding
> CPU vmap_block_queue. Consequently, purge_fragmented_block() might
> use the wrong vbq->lock to protect the free list, leading to vbq->free
> breakage.
> 
> ...
>
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2269,10 +2269,9 @@ static void _vm_unmap_aliases(unsigned long start, unsigned long end, int flush)
>  	for_each_possible_cpu(cpu) {
>  		struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
>  		struct vmap_block *vb;
> -		unsigned long idx;
> 
>  		rcu_read_lock();
> -		xa_for_each(&vbq->vmap_blocks, idx, vb) {
> +		list_for_each_entry_rcu(vb, &vbq->free, free_list) {
>  			spin_lock(&vb->lock);
> 
>  			/*
> ---
> https://lore.kernel.org/all/20240530025144.1570865-1-zhaoyang.huang@unisoc.com/
> BTW, zhangyang also encounter the same issue, maybe revert commit not a
> better solution. we need a map to get vbq from vb.

I borrowed the Fixes: from that patch and added cc:stable, pending
confirmation that the runtime effects are significant.



      parent reply	other threads:[~2024-05-30 20:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30  9:31 hailong.liu
2024-05-30 20:03 ` Andrew Morton
2024-05-31  2:53   ` Hailong Liu
2024-05-30 20:05 ` Andrew Morton [this message]

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=20240530130541.c615fcfc1e6f211199315e13@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=21cnbao@gmail.com \
    --cc=guangye.yang@mediatek.com \
    --cc=hailong.liu@oppo.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuhailong@oppo.com \
    --cc=lstoakes@gmail.com \
    --cc=urezki@gmail.com \
    --cc=xiang@kernel.org \
    --cc=zhaoyang.huang@unisoc.com \
    /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