[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <272c0f71-e817-44a6-8798-0a1535427ba9@redhat.com>
Date: Thu, 11 Apr 2024 11:09:53 +0200
From: David Hildenbrand <david@...hat.com>
To: Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-s390@...r.kernel.org, kvm@...r.kernel.org,
Matthew Wilcox <willy@...radead.org>, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>, Alexander Gordeev
<agordeev@...ux.ibm.com>, Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, Janosch Frank <frankja@...ux.ibm.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Thomas Huth <thuth@...hat.com>
Subject: Re: [PATCH v1 2/5] s390/uv: convert gmap_make_secure() to work on
folios
[...]
>> + if (rc == -E2BIG) {
>> + /*
>> + * Splitting might fail with -EBUSY due to unexpected folio
>> + * references, just like make_folio_secure(). So handle it
>> + * ahead of time without the PTL being held.
>> + */
>> + folio_lock(folio);
>> + rc = split_folio(folio);
>
> if split_folio returns -EAGAIN...
>
>> + folio_unlock(folio);
>> + folio_put(folio);
>> + }
>> +
>> if (rc == -EAGAIN) {
>
> ... we will not skip this ...
>
>> /*
>> * If we are here because the UVC returned busy or partial
>> * completion, this is just a useless check, but it is safe.
>> */
>> - wait_on_page_writeback(page);
>> - put_page(page);
>> + folio_wait_writeback(folio);
>> + folio_put(folio);
>
> ... and we will do one folio_put() too many
>
>> } else if (rc == -EBUSY) {
>> /*
>> * If we have tried a local drain and the page refcount
>
> are we sure that split_folio() can never return -EAGAIN now and in the
> future too?
Yes, and in contrast to documentation, that can actually happen! The
documentation is even wrong: we return -EAGAIN if there are unexpected
folio references (e.g., pinned), thanks for raising that.
>
> maybe just change it to } else if (... ?
I think I'll make it all clearer by handling split_folio() return values
separately.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists