Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2737250imj; Mon, 18 Feb 2019 11:12:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ10Bx3iHkeeyOF/1OUIDfNyG0yk18DM2iP2Fx3Ss0uVAQJLhzdtJ9AXRyvOuc12xL6kRrQ X-Received: by 2002:a63:c54b:: with SMTP id g11mr20194467pgd.441.1550517178423; Mon, 18 Feb 2019 11:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550517178; cv=none; d=google.com; s=arc-20160816; b=yTSFOSsuh0JqWii9/Jx9b2+eR9lEtPI+HNtEGIvSQoHD3OvkF663pO+fomFNTzE+1F QO7GWk9S3xpxdaKiBIbaac8w700eU5m6/O982QGNb1L6W8F11IWucAE2c+6KSf5aLSim LOuUJs6zNzgEk2WxGECV00EpmS77Mx5rf2ZtbyAWh+WJxCGdsWLSHjjcNTfVtl0yms77 WLW4y5JHQt8D/wzOrs/I2cDRPyqFxfSaEXmZCumuj3bEJUMu+hsxYn3AEi9vJL742avW mcECEWP9ewB9B+V8dFaGC1TqrBBC/vCjQ85Qqgh0DWnC5rLi+JzC/YURh6YXCAIA++sH /GiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=g2UasSOVduo4Pn1t6looKIhYnzUquXamY1qe8zmaCUs=; b=zUyU9F5xTiJM1fWFacWNbL60tgVLP+eRi2jVxCa0uHiMxFFWyoaGwLK2b92UJZq6kz 3HF9TFFY4+P4OsvCr1xneLwAGlr33La/PLNOZI/8CrOPvWxPkd9SjWHj+ZZ9HiMYjtpr iSULPN7XQRomM34Ug/hOjLO3ApwgZaxYS6PCuD4HuFZ68nSV4eUgTzG0YHOItp3U/WPl Bg+5aFgAB4/6EkRR07BiiM2ktUdu144r9As9khb8xAgIMBa4xpE6X2LCrho4fHfWFQfR 2fTBn9Bqb0HQhsModxHVytxsOj7fr22tMP1pfFs11qeXLrXrTs30kHNOMzl4im2B8Hnh oPEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EHo5dniL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t85si7249822pfa.110.2019.02.18.11.12.42; Mon, 18 Feb 2019 11:12:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EHo5dniL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391499AbfBRRw2 (ORCPT + 99 others); Mon, 18 Feb 2019 12:52:28 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59906 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733043AbfBRRw1 (ORCPT ); Mon, 18 Feb 2019 12:52:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=g2UasSOVduo4Pn1t6looKIhYnzUquXamY1qe8zmaCUs=; b=EHo5dniLrM/vmG3M0pRQk566g 4qKO4CXsRCLz5jjir8alD/8vEmVbKNo549TgKV64dx7kyjb2ivG7X+dX9m9bpeG0PDZCVKi+ZEh+y 1+H8QLqSKkHnToZ8DnrlDK7AfXTR71F516hZ4X5ei0TlLZV2WbkrXhXP88a/y1G0ACwV4ivkKLtqb LZyqUCP4tC9i1O1dSCgvD+mrl0+0+nm/wKVi2GSRSk5QW0dJA+tUbDpJSdNP8bb4gXPA5xzIJKtKx H0/EquC/MBVd7elx6AnapGJ0MdBHBRjKQmSBx+9ygzNU+ImdcGwi+9nfMAXHYzvitGu8q5a/1ffkN dUzf7qjgg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gvn5d-0000Zt-4c; Mon, 18 Feb 2019 17:52:25 +0000 Date: Mon, 18 Feb 2019 09:52:24 -0800 From: Matthew Wilcox To: Zi Yan Cc: Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , Michal Hocko , "Kirill A . Shutemov" , Andrew Morton , Mel Gorman , John Hubbard , Mark Hairgrove , Nitin Gupta , David Nellans Subject: Re: [RFC PATCH 01/31] mm: migrate: Add exchange_pages to exchange two lists of pages. Message-ID: <20190218175224.GT12668@bombadil.infradead.org> References: <20190215220856.29749-1-zi.yan@sent.com> <20190215220856.29749-2-zi.yan@sent.com> <20190217112943.GP12668@bombadil.infradead.org> <65A1FFA0-531C-4078-9704-3F44819C3C07@nvidia.com> <2630a452-8c53-f109-1748-36b98076c86e@suse.cz> <53690FCD-B0BA-4619-8DF1-B9D721EE1208@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53690FCD-B0BA-4619-8DF1-B9D721EE1208@nvidia.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 18, 2019 at 09:51:33AM -0800, Zi Yan wrote: > On 18 Feb 2019, at 9:42, Vlastimil Babka wrote: > > On 2/18/19 6:31 PM, Zi Yan wrote: > > > The purpose of proposing exchange_pages() is to avoid allocating any > > > new > > > page, > > > so that we would not trigger any potential page reclaim or memory > > > compaction. > > > Allocating a temporary page defeats the purpose. > > > > Compaction can only happen for order > 0 temporary pages. Even if you > > used > > single order = 0 page to gradually exchange e.g. a THP, it should be > > better than > > u64. Allocating order = 0 should be a non-issue. If it's an issue, then > > the > > system is in a bad state and physically contiguous layout is a secondary > > concern. > > You are right if we only need to allocate one order-0 page. But this also > means > we can only exchange two pages at a time. We need to add a lock to make sure > the temporary page is used exclusively or we need to keep allocating > temporary pages > when multiple exchange_pages() are happening at the same time. You allocate one temporary page per thread that's doing an exchange_page().