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 03A12C47080 for ; Tue, 1 Jun 2021 20:27:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B5568613C0 for ; Tue, 1 Jun 2021 20:27:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5568613C0 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 198196B006C; Tue, 1 Jun 2021 16:27:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16F546B006E; Tue, 1 Jun 2021 16:27:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 037056B0070; Tue, 1 Jun 2021 16:27:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id C78226B006C for ; Tue, 1 Jun 2021 16:27:31 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6B329B9EE for ; Tue, 1 Jun 2021 20:27:31 +0000 (UTC) X-FDA: 78206290302.17.117B294 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id E01F98019369 for ; Tue, 1 Jun 2021 20:27:17 +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=30+VAi/gUQPHVAYLWEtLXg5TLFDkyPVFmvnpsxX/JzQ=; b=dDV+5DnwINpdtZzOYTur+fuRym 6MtJdGy6ECAbBGEyCNEj/Xp9QP6Gr3a4caJ1gRGcJTCa47cQ75v+htJjPQmDeihgQLBgcmBd+lltw 6f6xIHGOIEjf46QQazj5V0blO7hBZ5KnyNRZrpd/4pD3JU6jaVKyjHv6PZjfzkVIOVOfCH8FtQAg7 D2os4RmDWFpR4fUy4hzL5KLM59LeVW0vuPNMYAAPav+Q0BCtfy66KxcEFBFMZ38jN4jFbNHtOA9Bv FPbp9/75Y751ihJOHxs66kYurSPEu7SNwVXwgqg/lSCI4kpUe3NzoFnwXh8mAne6DN0e0YGThswwn dRo9Vmtw==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1loAym-00APTG-DK; Tue, 01 Jun 2021 20:27:19 +0000 Date: Tue, 1 Jun 2021 21:27:12 +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: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dDV+5Dnw; spf=none (imf27.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: E01F98019369 X-Stat-Signature: 8is9m6qszc1zhynwegrxq6snireux1qz X-HE-Tag: 1622579237-22030 X-Bogosity: Ham, tests=bogofilter, spamicity=0.014343, 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 12:10:48PM -0700, 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? Oh, I wish! I haven't been working on converting the migration code to use folios. If I'd taken the step to convert put_and_wait_on_page_locked() to folio_put_and_wait_locked(), I would have fixed the bug, but I'm not sure I would have noticed that it was fixing a bug. I would have probably converted migration_entry_to_page() to be migration_entry_to_folio() and just inadvertently fixed it. > > 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. That would certainly make a difference.