On Mon, Jun 19, 2017 at 02:47:23PM +0200, Jan Kara wrote: > The condition checking for THP straddling end of invalidated range is > wrong - it checks 'index' against 'end' but 'index' has been already > advanced to point to the end of THP and thus the condition can never be > true. As a result THP straddling 'end' has been fully invalidated. Given > the nature of invalidate_mapping_pages(), this could be only performance > issue. In fact, we are lucky the condition is wrong because if it was > ever true, we'd leave locked page behind. > > Fix the condition checking for THP straddling 'end' and also properly > unlock the page. Also update the comment before the condition to explain > why we decide not to invalidate the page as it was not clear to me and I > had to ask Kirill. > > Signed-off-by: Jan Kara <jack@xxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Thanks a lot for the fix. -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>