From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 362ABC83F11 for ; Sun, 27 Aug 2023 13:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjH0NIZ (ORCPT ); Sun, 27 Aug 2023 09:08:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbjH0NIB (ORCPT ); Sun, 27 Aug 2023 09:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63696EC for ; Sun, 27 Aug 2023 06:07:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F22FD61561 for ; Sun, 27 Aug 2023 13:07:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D53DC433C8; Sun, 27 Aug 2023 13:07:56 +0000 (UTC) Date: Sun, 27 Aug 2023 16:07:55 +0300 From: Catalin Marinas To: Waiman Long Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yisheng Xie Subject: Re: [PATCH] mm/kmemleak: Move up cond_resched() call in page scanning loop Message-ID: References: <20230825164947.1317981-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230825164947.1317981-1-longman@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 25, 2023 at 12:49:47PM -0400, Waiman Long wrote: > Commit bde5f6bc68db ("kmemleak: add scheduling point to kmemleak_scan()") > added a cond_resched() call to the struct page scanning loop to prevent > soft lockup from happening. However, soft lockup can still happen in > that loop in some corner cases when the pages that satisfy the "!(pfn & > 63)" check are skipped for some reasons. > > Fix this corner case by moving up the cond_resched() check so that it > will be called every 64 pages unconditionally. > > Fixes: bde5f6bc68db ("kmemleak: add scheduling point to kmemleak_scan()") > Signed-off-by: Waiman Long Acked-by: Catalin Marinas