Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp510338pxj; Wed, 2 Jun 2021 05:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIcR20WNtjdr5D1PQyyUemfD4F6m+KmFEXyP/PnvbJN3XHf6oLCWvSEKNBjvyXOG1j5dxJ X-Received: by 2002:a17:907:7b99:: with SMTP id ne25mr17483269ejc.467.1622635204612; Wed, 02 Jun 2021 05:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622635204; cv=none; d=google.com; s=arc-20160816; b=y7lh2aY0+Zn48U9TnnuagkWC7ksAIwBRBfL5DQ5Z5ZjFM3p5VYhQXyUqBZ/b/RBuLw KOQzZWPlBxig+9sGVk3VyJQ4CVDwuUH8mOSYemzwaAUrc1v/31UJfDBPmMuykDTW3c4S vVXAjv/+e9N3ALdH2eDCh8VaZM8HqJtaT82kTNRwObSP9qA504mEhOmjRp8/AhfqV+Zw /Pq9jUbp5jnObPSZ+BuPCOmmwdufWIgmbu9zkQr/esZuPytmpc49kP7Xo1pKePC/w3vC g4FvkgeMXrg9zamZIOZmRRF71xQMGZETTiXk5BgDMXG4h3+eGHd7EHFPFwZSOum5TZUT 1C+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mQopZOGEyPUPV5G5APHCEl13iaIRug2yhfkIsJePiyA=; b=TKanN6ekS8RuYw5bsbwME1sbbGS6Na/wz1RgRG9STj4qpK815ikT2ZNQ3oecH8kNmk BOh7kVwspst4MAnDd/9KXsW98cs0wXN505Ks4lRHgHWyxp/VQqv/IGF6kTX3zcGQf8+s fKOp9grEOfd2BniufsyxaPIxsulD8yAgzwHUph2PVqwDtwCOb7JcxDrPxm60JXDpk31B xH0++kfMwnWqXCZmHiREA+2uaFrwCd9z/tDVndURlMRpBb1qY/SHUF+yYyG3G53cgdck A6zHaXt4t/kHH42QI3DGjf6iHcXSuNfxrodZKIqRmn6nKqTMnTGGxlXyF+XVFupbLp5f t4dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vZjiGz3I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si276635edq.296.2021.06.02.04.59.42; Wed, 02 Jun 2021 05:00:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vZjiGz3I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbhFBMAc (ORCPT + 99 others); Wed, 2 Jun 2021 08:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbhFBMAb (ORCPT ); Wed, 2 Jun 2021 08:00:31 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8EFC061574 for ; Wed, 2 Jun 2021 04:58:49 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.