On Tue, Oct 15, 2019 at 8:33 PM Michal Hocko wrote: > On Sat 12-10-19 18:25:12, Gaowei Pu wrote: > > get_unmapped_area already cover the offset_in_page() check and returned > > with error ptr. So replace offset_in_page() with IS_ERR_VALUE(). > > I have to say that I found offset_in_page check quite unintuitive. It is > a relict from the past I suspect. A newer code seems to use > IS_ERR_VALUE. If we want to make the code consistent then I am for it. > Could you check other users as well? git grep suggests checking > kernel/events/uprobes.c, mm/mmap.c and mm/mremap.c. > I only noticed the offset_in_page check after returned from get_unmapped_area is redundant. So I just replace the places where get_unmapped_area returned. As you mentioned, IS_ERR_VALUE maybe the newer code to check the error ptr compared to offset_in_page which is really unintuitive and therefore I will replace them in mm/mmap.c and mm/mremap.c. > I would simply use the following for the changelog > " > get_unmapped_area returns an address or -errno on failure. Historically > we have checked for the failure by offset_in_page() which is correct but > quite hard to read. Newer code started using IS_ERR_VALUE which is much > easier to read. Convert remaining users of offset_in_page as well. > > This shouldn't introduce any functional changes. > " > > OK, I will use your changelog and resend a patch. Thanks. > > > 2.23.0 > > > > -- > Michal Hocko > SUSE Labs >