Re: [PATCH v10 00/62] Convert page cache to XArray

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/04/2018 08:52 PM, Matthew Wilcox wrote:
> On Wed, Apr 04, 2018 at 09:35:46AM -0700, Mike Kravetz wrote:
>> Running with this XArray series on top of next-20180329 consistently 'hangs'
>> on shutdown looping (?forever?) in tag_pages_for_writeback/xas_for_each_tag.
>> All I have to do is make sure there is some activity on the ext4 fs before
>> shutdown.  Not sure if this is a 'next-20180329' issue or XArray issue.
>> But the fact that we are looping in xas_for_each_tag looks suspicious.
> 
> Thanks for your help debugging this!  Particularly collecting the xa_dump.
> I got bit by the undefined behaviour of shifting by BITS_PER_LONG,
> but of course it was subtle.
> 
> The userspace testing framework wasn't catching this for a couple of
> reasons; I'll work on making sure it catches this kind of thing in
> the future.
> 
> I'll fold this in and post a v11 later this week or early next week.

Nice!  Added patch and it solves the hangs I observed.

-- 
Mike Kravetz

> 
> diff --git a/include/linux/xarray.h b/include/linux/xarray.h
> index eac04922eba2..f5b7e507a86f 100644
> --- a/include/linux/xarray.h
> +++ b/include/linux/xarray.h
> @@ -904,9 +929,12 @@ static inline unsigned int xas_find_chunk(struct xa_state *xas, bool advance,
>  	if (advance)
>  		offset++;
>  	if (XA_CHUNK_SIZE == BITS_PER_LONG) {
> -		unsigned long data = *addr & (~0UL << offset);
> -		if (data)
> -			return __ffs(data);
> +		if (offset < XA_CHUNK_SIZE) {
> +			unsigned long data = *addr & (~0UL << offset);
> +
> +			if (data)
> +				return __ffs(data);
> +		}
>  		return XA_CHUNK_SIZE;
>  	}
>  
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux