[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1297525.1674593711@warthog.procyon.org.uk>
Date: Tue, 24 Jan 2023 20:55:11 +0000
From: David Howells <dhowells@...hat.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: dhowells@...hat.com, Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
Jens Axboe <axboe@...nel.dk>, "Jan Kara" <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
David Hildenbrand <david@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Logan Gunthorpe <logang@...tatee.com>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, "Christoph Hellwig" <hch@....de>
Subject: Re: [PATCH v9 4/8] block: Fix bio_flagged() so that gcc can better optimise it
John Hubbard <jhubbard@...dia.com> wrote:
> I don't know how you noticed that this was even a problem! Neatly
> fixed.
I wanted BIO_PAGE_REFFED/PINNED to translate to FOLL_GET/PIN with no more than
a single AND instruction, assuming they were assigned to the same values (1 &
2), so I checked to see what assembly was produced by:
gup_flags |= bio_flagged(bio, BIO_PAGE_REFFED) ? FOLL_GET : 0;
gup_flags |= bio_flagged(bio, BIO_PAGE_PINNED) ? FOLL_PIN : 0;
Complicated though it looks, it should optimise down to something like:
and $3,%eax
assuming something like REFFED/GET == 0x1 and PINNED/PIN == 0x2.
David
Powered by blists - more mailing lists