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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 D1FADC4708F for ; Wed, 2 Jun 2021 11:58:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E895613B1 for ; Wed, 2 Jun 2021 11:58:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E895613B1 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 BD73D6B006C; Wed, 2 Jun 2021 07:58:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B603E6B006E; Wed, 2 Jun 2021 07:58:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D9DF6B0070; Wed, 2 Jun 2021 07:58:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 698A36B006C for ; Wed, 2 Jun 2021 07:58:50 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ECED2180AD802 for ; Wed, 2 Jun 2021 11:58:49 +0000 (UTC) X-FDA: 78208637178.12.4498776 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 41B8E2001093 for ; Wed, 2 Jun 2021 11:58:37 +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=mQopZOGEyPUPV5G5APHCEl13iaIRug2yhfkIsJePiyA=; b=vZjiGz3Ipz7NThkF9NAxLmGyFJ OIDbNdzRaAE8h3S4YUTFg4S+S59Mii3RlwzclKY4d4ymOwGAacIATCpxbSQ3nqybDFI0SgXGWvlDd jAfyp4JGoQXBCaEJZROGMzT9ueJSAemseIuoK7g4S+hIFHbBqGSN5E7tR59Cb+ZWqumHt9MErBMcw yhF9Qr+By+jiAjcH+qvqjWsLSDPStYCd9KihSd8ruMslDRLS2dWzZ/9fluxUIcx102xm4gHIHOtas nYKdXX/5LGznaeevWjJlPW2CGV7b/zg86PV5E9YujhcT2cXJu4xjPhhFymmrGNyH6E6Wkvp3qO5lL YHdvjQ4g==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1loPVk-00B40Q-Nv; Wed, 02 Jun 2021 11:58:19 +0000 Date: Wed, 2 Jun 2021 12:58:12 +0100 From: Matthew Wilcox To: Yu Xu Cc: Hugh Dickins , 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: <71c320bf-3fcb-f8c0-65e4-ff706af05607@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71c320bf-3fcb-f8c0-65e4-ff706af05607@linux.alibaba.com> Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vZjiGz3I; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 41B8E2001093 X-Stat-Signature: 3umos67hd9zj7csetoneyzpmy1y3w7ka X-HE-Tag: 1622635117-345520 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000036, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 02, 2021 at 11:27:47AM +0800, Yu Xu wrote: > On 6/2/21 3:10 AM, Hugh Dickins wrote: > > On Tue, 1 Jun 2021, Matthew Wilcox wrote: > > > On Tue, Jun 01, 2021 at 09:55:56AM -0700, Hugh Dickins wrote: > > > > > > > > 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? ;-) > > > > Hah! Well, I do realize that I'm offering you a marketing opportunity. > > And you won't believe how many patches I dread to post for fear of that ;-) > > > > But I'm not so sure that it strengthens your case: apparently folios > > had not detected this? Or do you have a hoard of folio-detected fixes > > waiting for the day, and a folio-kit for each of the stable releases? > > > > > > > > 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. > > > > I think that's a good point: I may have just jumped on the missing > > compound_head(), without thinking it through as far as you have. > > > > I'm having trouble remembering the dynamics now; but I think there > > are cond_resched()s in the unmap_page() part, so the splitter may > > get preempted even on a non-preempt kernel; whereas the frozen > > part is all done expeditiously, with interrupts disabled. > > > > Greg discovered the same issue recently, but we all got sidetracked, > > and I don't know where his investigation ended up. He was in favour > > of cond_resched(), I was in favour of compound_head(); and I think I > > I ever considered about using compound_head, but isn't there another > race that, the following put_and_wait_on_page_locked operates on the > "tail page" which has been split and is now a single page? No, having your own reference on a page prevents the page from being split. But that's a good question to ask.