On 09/10/19, 6:43 PM, "Vlastimil Babka" <[email protected]> wrote:
>> Reported-by: Jann Horn <[email protected]> >> Acked-by: Matthew Wilcox <[email protected]> >> Cc: [email protected] >> Signed-off-by: Linus Torvalds <[email protected]> >> [ 4.4.y backport notes: >> Ajay: Added local variable 'err' with-in follow_hugetlb_page() >> from 2be7cfed995e, to resolve compilation error >> Srivatsa: Replaced call to get_page_foll() with try_get_page_foll() ] >> Signed-off-by: Srivatsa S. Bhat (VMware) <[email protected]> >> Signed-off-by: Ajay Kaher <[email protected]> >> --- >> mm/gup.c | 43 ++++++++++++++++++++++++++++++++----------- >> mm/hugetlb.c | 16 +++++++++++++++- >> 2 files changed, 47 insertions(+), 12 deletions(-) > > This seems to have the same issue as the 4.9 stable version [1], in not > touching the arch-specific gup.c variants. > > [1] > https://lore.kernel.org/lkml/[email protected]/ Thanks Vlastimil for highlighting this here. Yes, arch-specific gup.c variants also need to handle not only for 4.4.y, however it should be handled till 4.19.y. I believe it's better to start from 4.19.y and then backport those changes till 4.4.y. Affected areas of gup.c (where page->count have been used) are: #1: get_page() used in these files and this is safe as it's defined in mm.h (here it's already taken care of) #2: get_head_page_multiple() has following: VM_BUG_ON_PAGE(page_count(page) == 0, page); Need to change this to: VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page); #3: Some of the files have used page_cache_get_speculative(), page_cache_add_speculative() with combination of compound_head(), this scenario needs to be handled as it was handled here: https://lore.kernel.org/stable/[email protected]/ Please share with me any suggestions or patches if you have already worked on this. Could we handle arch-specific gup.c in different patch sets and let these patches to merge to 4.4.y? - Ajay

