[PATCH xwayland] xwayland-shm: fortify fallocate against EINTR

Pekka Paalanen ppaalanen at gmail.com
Mon Apr 25 13:10:43 UTC 2016


On Mon, 25 Apr 2016 15:56:58 +0300
Ian Ray <ian.ray at ge.com> wrote:

> On Mon, Apr 25, 2016 at 02:40:31PM +0200, Marek Chalupa wrote:
> > 
> > On 04/25/16 12:20, Pekka Paalanen wrote:  
> > > On Mon, 25 Apr 2016 11:33:00 +0200
> > > Marek Chalupa <mchqwerty at gmail.com> wrote:
> > >  
> > >> If posix_fallocate or ftruncate is interrupted by signal
> > >> while working, we return -1 as fd and the allocation process
> > >> returns BadAlloc error. That causes xwayland clients to abort
> > >> with 'BadAlloc (insufficient resources for operation)'
> > >> even when there's a lot of resources available.
> > >>
> > >> Fix it by trying again when we get EINTR.  
> 
> I have recently hit this, on a rather low powered platform, and solved
> the problem slightly differently by falling-back to ftruncate. (Posted
> to the list just now in a separate thread.)
> 
> <snip>
> > > Hi Marek,
> > >
> > > curious, how did you hit this case? And is the signal that intercept
> > > these usually the smart scheduler's SIGALRM?  
> > 
> > Hi Pekka,
> > 
> > under gnome-shell it's enough to open terminator and resize it very
> > quickly. Under Weston (and also gnome-shell) I hit this with Firefox.
> > Just start it and in a moment it goes down with this error.  
> 
> I wonder if immediately falling-back to ftruncate is too aggressive?

Hello Ian,

I would not do that, because it exposes Xwayland to SIGBUS in case the
tmpfs runs of out space. It might be a usable workaround for you,
though.

I would really like to know if there is something wrong on your
platform that makes fallocate on tmpfs so painfully slow, and is
fallocate supposed to make progress if simply restarted like in Marek's
patch.

In the mean time, Marek's patch gets my
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
because it is an improvement for many (most?) systems.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160425/5b0a789d/attachment.sig>


More information about the xorg-devel mailing list