Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3255641imj; Mon, 18 Feb 2019 23:43:03 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib2VU12LN+f4OHzPwxuvNPuNCyZdHTKGnevzRANYtoLC73qWcvtK+MILZBI613gbHr6YoHS X-Received: by 2002:aa7:854d:: with SMTP id y13mr28129774pfn.175.1550562183545; Mon, 18 Feb 2019 23:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550562183; cv=none; d=google.com; s=arc-20160816; b=gs1J+jB0tOHaiGVFfEunWueqG47YOyDpn3sNnDmHzCxSsFg6k4XiH33wzSwbv03YJ3 pWBCfpmhGhRNUVEboAgT5suPHybpFDU3JMp1HJQzD6I69nwm6FlG2GvMCs6Z7fVAut+e UytMqb8+T+dIChMeTCrIJwNZ4BV3310jMacIcC/lNLYi2deGXgNYoEzElCcPODpR4bWQ nudLfmZBSS0N+yY0G2A06zc6rdOeez3I+nVCdrBRwxzH03rJ2B2XTbIoh426WB+AHnWn QNEahYCkurTiQ1lQICTWKqJUqPbfJiiCsQkU6+rWZJ7Px/hNQHa7OCSf9LWSX4+Di6r8 mPkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=qEJl9mUubSlT9za5dgpozb7BS1FHoR1awuBUyAElKKA=; b=Hswvrcwr31x9DmCQFdoQ6DrhS7XglwWiOqjUoBmiOKJMRntbMESdzwKUdeKAlgHQXr D5janCqxuqZD/Qk+CoHlcMJjWiia0qg7iuxjO8/E+D1MF1sxot7QkP8HaEE7ecX1skvO 18mPoz1MGJ5zqb3FVT5Hbh6OrzdBFiLQkxS4Bn9Kawin/H5nEdQJ1GBQvnXI/yqJocQm d3V3olJ9tqeLU/pX8crfUflXjfqD7/SlJOq8/iwK7AvjO3nb2RWh72OxNItKhnTzdhkI DxP5nE3ZLYiGEdhph+hpHdSFPaYEjWW8DTrS5h88W+gu1AzT4xujNo/a+sVEcHLcnXsc kEwA== ARC-Authentication-Results: i=1; mx.google.com; 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 e3si3134854pfi.223.2019.02.18.23.42.48; Mon, 18 Feb 2019 23:43:03 -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; 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 S1726919AbfBSHmM (ORCPT + 99 others); Tue, 19 Feb 2019 02:42:12 -0500 Received: from foss.arm.com ([217.140.101.70]:41304 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbfBSHmM (ORCPT ); Tue, 19 Feb 2019 02:42:12 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3777780D; Mon, 18 Feb 2019 23:42:09 -0800 (PST) Received: from [10.162.40.139] (p8cg001049571a15.blr.arm.com [10.162.40.139]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A00143F720; Mon, 18 Feb 2019 23:42:04 -0800 (PST) Subject: Re: [RFC PATCH 01/31] mm: migrate: Add exchange_pages to exchange two lists of pages. To: Zi Yan , Matthew Wilcox 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 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> <20190218175224.GT12668@bombadil.infradead.org> From: Anshuman Khandual Message-ID: <1ce6ae99-4865-df62-5f20-cb07ebb95327@arm.com> Date: Tue, 19 Feb 2019 13:12:07 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/18/2019 11:29 PM, Zi Yan wrote: > On 18 Feb 2019, at 9:52, Matthew Wilcox wrote: > >> 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(). > > Yeah, you are right. I think at most I need NR_CPU order-0 pages. I will try > it. Thanks. But the location of this temp page matters as well because you would like to saturate the inter node interface. It needs to be either of the nodes where the source or destination page belongs. Any other node would generate two internode copy process which is not what you intend here I guess.