[Top] [All Lists]

Re: [PATCH] xfstests: initialize "valid" bitmap in randholes.c

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfstests: initialize "valid" bitmap in randholes.c
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 6 Feb 2014 10:02:05 +1100
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <52F2848B.5070704@xxxxxxxxxx>
References: <52F2848B.5070704@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Feb 05, 2014 at 12:35:55PM -0600, Eric Sandeen wrote:
> Failures were reported in xfs/008 on s390; dchinner suggested that
> perhaps the uninitialized "valid" bitmap was behaving differently on
> that platform, and sure enough, this patch fixes things up.
> TBH, I'm not sure why using an uninitialized bitmap worked at
> all, ever, anywhere...?

It depends on glibc behaviour to whether newly allocated memory is
zeroed or not. e.g. for large allocations glibc uses
mmap() to directly map anonymous pages for the allocation. These get
zeroed by the kernel before being mapped into the user address
space. If glibc allocates from the heap and needs to grow it, it
uses sbrk() to grow the heap an dthose pages are, again, zeroed by
the kernel. However, if the allocation comes from the heap from
previously freed memory, then it doesn't get zeroed.

I'd say that the 3rd case is occurring here - there's memory that is
allocated and freed as part of the program startup that the bitmap
is being allocated from, and so it's not newly zeroed pages that it
is being allocated from...

Regardless of the cause, the fix looks good.

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>