From patchwork Mon Apr 12 03:58:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 420171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 536B8C433ED for ; Mon, 12 Apr 2021 03:59:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FD76600CD for ; Mon, 12 Apr 2021 03:59:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235386AbhDLD71 (ORCPT ); Sun, 11 Apr 2021 23:59:27 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:54952 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235261AbhDLD71 (ORCPT ); Sun, 11 Apr 2021 23:59:27 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R181e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04423; MF=wenyang@linux.alibaba.com; NM=1; PH=DS; RN=13; SR=0; TI=SMTPD_---0UVDAH8A_1618199943; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0UVDAH8A_1618199943) by smtp.aliyun-inc.com(127.0.0.1); Mon, 12 Apr 2021 11:59:08 +0800 From: Wen Yang To: Greg Kroah-Hartman , Sasha Levin Cc: stable , Hugh Dickins , Michal Hocko , David Rientjes , Gerald Schaefer , Andrew Morton , Linus Torvalds , Chen si , Baoyou Xie , Wen Yang , Zijiang Huang Subject: [RESEND PATCH 4.9] mm: add cond_resched() in gather_pte_stats() Date: Mon, 12 Apr 2021 11:58:57 +0800 Message-Id: <20210412035857.82868-1-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hugh Dickins commit a66c0410b97c07a5708881198528ce724f7a3226 upstream. The other pagetable walks in task_mmu.c have a cond_resched() after walking their ptes: add a cond_resched() in gather_pte_stats() too, for reading /proc//numa_maps. Only pagemap_pmd_range() has a cond_resched() in its (unusually expensive) pmd_trans_huge case: more should probably be added, but leave them unchanged for now. Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1612052157400.13021@eggly.anvils Signed-off-by: Hugh Dickins Acked-by: Michal Hocko Cc: David Rientjes Cc: Gerald Schaefer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Cc: # 4.9.x Reported-by: Chen si Signed-off-by: Baoyou Xie Signed-off-by: Wen Yang Signed-off-by: Zijiang Huang --- fs/proc/task_mmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 4b207b1..e6c8ead 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1609,6 +1609,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, } while (pte++, addr += PAGE_SIZE, addr != end); pte_unmap_unlock(orig_pte, ptl); + cond_resched(); return 0; } #ifdef CONFIG_HUGETLB_PAGE