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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 559C3C4708F for ; Tue, 1 Jun 2021 17:11:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F205A613BD for ; Tue, 1 Jun 2021 17:11:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F205A613BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 903F06B0070; Tue, 1 Jun 2021 13:11:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88CFA6B0071; Tue, 1 Jun 2021 13:11:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72E496B0072; Tue, 1 Jun 2021 13:11:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 3BAF26B0070 for ; Tue, 1 Jun 2021 13:11:18 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D6D77181AEF10 for ; Tue, 1 Jun 2021 17:11:17 +0000 (UTC) X-FDA: 78205795794.01.0A85A5E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 95DDFA000241 for ; Tue, 1 Jun 2021 17:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NPf5x5gUIVGWbZsyHctHSrCy7CgzrGDQAuJK0Pfsp3Y=; b=WlE4PI42i6Y6aDb/sYuOCvJ1gY RfLnhnWbAfBudWuf90hOxdqLJhVGrsOBAxt3Mgi/HNcUps/2Ki5MDTRa6FSqnfnH6uGhQb9a+eXfi 6D6szn2br23LVELB59uzFnC3B6jYRDoIU+VM8xIeNFkkGkEaHyeV7NlGZTTcAbc5lbbyKbgDU6QpC RrEtd2GgWcxzRmoWJfDYAU9vyTS+4R9kjyx+I5fBeR6KAyXmfIVLBrCcuFZBhCvl0lxz3LebseLXG zNNI5twSQdFutcu+ImqvVCTTTJnftTiWA/Q+LglDxAiM4YWs7hT/MCxhVXr4KsMBJLaZKma1Srch+ TtlFl8aQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lo7uy-00AEsQ-Pn; Tue, 01 Jun 2021 17:11:06 +0000 Date: Tue, 1 Jun 2021 18:11:04 +0100 From: Matthew Wilcox To: Hugh Dickins Cc: Xu Yu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, gavin.dg@linux.alibaba.com, Greg Thelen , Wei Xu , Nicholas Piggin , Vlastimil Babka Subject: Re: [PATCH] mm, thp: relax migration wait when failed to get tail page Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=WlE4PI42; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: fwg4racpjju7s533m9my66e5n4ytyf1u X-Rspamd-Queue-Id: 95DDFA000241 X-Rspamd-Server: rspam02 X-HE-Tag: 1622567464-989047 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000031, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 01, 2021 at 09:55:56AM -0700, Hugh Dickins wrote: > On Wed, 2 Jun 2021, Xu Yu wrote: > > > We notice that hung task happens in a conner but practical scenario when > > CONFIG_PREEMPT_NONE is enabled, as follows. > > > > Process 0 Process 1 Process 2..Inf > > split_huge_page_to_list > > unmap_page > > split_huge_pmd_address > > __migration_entry_wait(head) > > __migration_entry_wait(tail) > > remap_page (roll back) > > remove_migration_ptes > > rmap_walk_anon > > cond_resched > > > > Where __migration_entry_wait(tail) is occurred in kernel space, e.g., > > copy_to_user, which will immediately fault again without rescheduling, > > and thus occupy the cpu fully. > > > > When there are too many processes performing __migration_entry_wait on > > tail page, remap_page will never be done after cond_resched. > > > > This relaxes __migration_entry_wait on tail page, thus gives remap_page > > a chance to complete. > > > > Signed-off-by: Gang Deng > > Signed-off-by: Xu Yu > > Well caught: you're absolutely right that there's a bug there. > But isn't cond_resched() just papering over the real bug, and > what it should do is a "page = compound_head(page);" before the > get_page_unless_zero()? How does that work out in your testing? You do realise you're strengthening my case for folios by suggesting that, don't you? ;-) I was going to suggest that it won't make any difference because the page reference count is frozen, but the freezing happens after the call to unmap_page(), so it may make a difference.