The patch titled Subject: mm/memory-failure: do pgoff calculation before for_each_process() has been added to the -mm tree. Its filename is mm-memory-failure-do-pgoff-calculation-before-for_each_process.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-memory-failure-do-pgoff-calculation-before-for_each_process.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-failure-do-pgoff-calculation-before-for_each_process.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Xianting Tian <tian.xianting@xxxxxxx> Subject: mm/memory-failure: do pgoff calculation before for_each_process() There is no need to calculate pgoff in each loop of for_each_process(), so move it to the place before for_each_process(), which can save some CPU cycles. Link: http://lkml.kernel.org/r/20200818082647.34322-1-tian.xianting@xxxxxxx Signed-off-by: Xianting Tian <tian.xianting@xxxxxxx> Acked-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/memory-failure.c~mm-memory-failure-do-pgoff-calculation-before-for_each_process +++ a/mm/memory-failure.c @@ -484,11 +484,12 @@ static void collect_procs_file(struct pa struct vm_area_struct *vma; struct task_struct *tsk; struct address_space *mapping = page->mapping; + pgoff_t pgoff; i_mmap_lock_read(mapping); read_lock(&tasklist_lock); + pgoff = page_to_pgoff(page); for_each_process(tsk) { - pgoff_t pgoff = page_to_pgoff(page); struct task_struct *t = task_early_kill(tsk, force_early); if (!t) _ Patches currently in -mm which might be from tian.xianting@xxxxxxx are mm-memory-failure-do-pgoff-calculation-before-for_each_process.patch