Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4579026pxj; Tue, 8 Jun 2021 18:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWYYfBTaszoB2Ij+2HPPy9/FLMbnmwdgH7guyQUmsx4bKLQpy4ae/9Eo4Mr4VxRRb5gyNJ X-Received: by 2002:a50:fa8c:: with SMTP id w12mr28483676edr.350.1623202638907; Tue, 08 Jun 2021 18:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623202638; cv=none; d=google.com; s=arc-20160816; b=EIPMcP8yWMednFOfQs8u/nTlQtfV/pXtLXgpi8ZNOE2xiuqXxEaGiegeFHPm16EKBH 3tVSQRZbGNikTO+8cjr2UWQjosOiXsPbTy8uMcHjytp1RosDheT8mvfe6kqjjin55lvk sjP9jdge6N03B3dg7f6EGe4H72nc5ZfID1ZM2sZyMUDh5K/fTdH/4nY46IP4TnYccITc g9u19xIeP19UMJVKtOgkGpSQZQncGRokvA8h0Aom9BnpX53tHWZSpmFw23+3q1y4mTNw /i9WV2xeF39v9lFoUqi9HmS+HDuP2V/G8+LTvAnLISYDF/5p1yY/OAfQYbaiQWq4qLkO KnIg== 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=riDPbwo++OTuXYeZ0Bw40T80J63Mte6osn02rTiXE80=; b=WXsVH2eqmSzyhgAdovVabTKDYPMwTPwglANry8bIiSZXdwgv+brat7Ynf4MtostWT/ bnAnxhwut2R5Ga7Z8utW6cPq8P6D+lXQDLiHwydPR5NCJ7V1DE2hVk26U6fZIfZHdeiZ huXTb9+akEnD5yfLvIXyvUisxIfC/CjXuSWqZHncAi3fssnQvRKGfNz9Tm1/B6WV/h53 p/73DntfhnJE1BuPt8dBvoTp7aBm0ZngaJXQAWTPERRy68+SYIuHIeqWmNBzDQP4tnOb PlNib9WH/8vF8uQ6LX5kEBrMwMAKPUNOoLmGb9a4Ay9WMefcyBD1mqeWp6Hx7K7bqpVU kXdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=oTf6wBN4; 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 rv24si1141431ejb.690.2021.06.08.18.36.55; Tue, 08 Jun 2021 18:37:18 -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=oTf6wBN4; 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 S232655AbhFHNhr (ORCPT + 99 others); Tue, 8 Jun 2021 09:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231162AbhFHNhr (ORCPT ); Tue, 8 Jun 2021 09:37:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548C8C061574 for ; Tue, 8 Jun 2021 06:35:54 -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=riDPbwo++OTuXYeZ0Bw40T80J63Mte6osn02rTiXE80=; b=oTf6wBN4d87+zmVui/ismOVXis 8f2sKfpd48v6VEaJ0yWlEJcuiqjxDpIndI4WRT4NQtxegM1werAAqhchcI8u0gs3g0IiHeB4ypwtp t8xscgHa2qxvXzQX7gDY8Uuy1qQyUaSaytX8Tk2ck/9/4lJXtmOmV8BKzMQuUpw5rwAEkZ1O4k1DS Hffvs4DrlOBR2orC2zlaSOlN1wPdXrjWRsfyuRXlTMDlb6urtuqu5UvKc21xZssTYlEkMkL7M+thQ Kr31qquX/XL6MBLzP6SQFcr46c7TLrswlBcZxv4xCM8AyHzlAuzZ+Hqk9iEetwHpNtZrZh4XVJnOQ iHiAlkJg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lqbt6-00Gyyh-0i; Tue, 08 Jun 2021 13:35:28 +0000 Date: Tue, 8 Jun 2021 14:35:23 +0100 From: Matthew Wilcox To: "Kirill A. Shutemov" Cc: Xu Yu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, hughd@google.com, akpm@linux-foundation.org, gavin.dg@linux.alibaba.com Subject: Re: [PATCH v2] mm, thp: use head page in __migration_entry_wait Message-ID: References: <20210608120026.ugfh72ydjeba44bo@box.shutemov.name> <20210608125838.6ixdlz3t334gjnp7@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210608125838.6ixdlz3t334gjnp7@box.shutemov.name> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 08, 2021 at 03:58:38PM +0300, Kirill A. Shutemov wrote: > On Tue, Jun 08, 2021 at 01:32:21PM +0100, Matthew Wilcox wrote: > > On Tue, Jun 08, 2021 at 03:00:26PM +0300, Kirill A. Shutemov wrote: > > > But there's one quirk: if split succeed we effectively wait on wrong > > > page to be unlocked. And it may take indefinite time if split_huge_page() > > > was called on the head page. > > > > Hardly indefinite time ... callers of split_huge_page_to_list() usually > > unlock the page soon after. Actually, I can't find one that doesn't call > > unlock_page() within a few lines of calling split_huge_page_to_list(). > > I didn't check all callers, but it's not guaranteed by the interface and > it's not hard to imagine a future situation when a page got split on the > way to IO and kept locked until IO is complete. I would say that can't happen. Pages are locked when added to the page cache and are !Uptodate. You can't put a PTE in a process page table until it's Uptodate, and once it's Uptodate, the page is unlocked. So any subsequent locks are transient, and not for the purposes of IO (writebacks only take the page lock transiently). > The wake up shouldn't have much overhead as in most cases split going to > be called on the head page. I'm not convinced about that. We go out of our way to not wake up pages (eg PageWaiters), and we've had some impressively long lists in the past (which is why we now have the bookmarks).