Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp31166ima; Sat, 20 Oct 2018 02:00:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ZPAEaWCX3TH4ys6+gwoJhx6dl1WoaR3GOlAOohapJRk6XpGC2FKDauLcCeI4vNXbntnfd X-Received: by 2002:a17:902:b284:: with SMTP id u4-v6mr4627079plr.123.1540026044553; Sat, 20 Oct 2018 02:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540026044; cv=none; d=google.com; s=arc-20160816; b=mBC6X/YRcZKtyGlP4av9Uo4z9BoO5e14//xb9AVZkFagyf/dgyu77LdGIxtJi2nglc vSxK75WAHg4CuUvQm6yrQGTi51rVqmqa4+277WIxbhMMe4vRuJywnXRN6OBCmpnB23eh 0sW8Qqfj7e9SwlSzdGQNV7CjrlfLbLIFV/vKDFheJIJlgZcZj/+9q8wvQdJyudSz64RL kcRt4oT9mcp3cwWef4FMW3gkdVA/7xdKXIQfU6I9oKMr5aqS3MO/n9+5iMAX18CkSbHQ kMA0esPZyliW+F/bgYuG4ZcvGqVDFh5H32VV82PFXFevJ+SydYs45BCEyiolbkg2J4A/ s52Q== 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; bh=byILut0wbujMoz1Xqx995ovRh4jx3lrQ20U8Z3fJKH0=; b=tlE09QNODa8utc+cHhxuk6KcKoL1FVKn2K8eCs+BAbxP5E4Uije/Ow7YbRXLbPyJk2 uZvb8B43mUy/uKyD8Ap699dzxX1VJNSgLI/N4nQtmE1gzXTGrW8TvGER9WH8YlwaL1hx 59TTiEC2J4/gt0utuAsP4slpjC+BclnQVIuVmjEi0o2f0BGkPOZG2JZi6axOvt2c9593 o26FSMfAiR2DKa5Xk6aRW06+sC6DxOdTIzcR8Td415hLzKbjdw8WF6Zsphj2S8vUtY4z vZzdmRRIHaDLAaEqyMJXzakmdBi9SFspvxwSFFGCmQg1+UwTvaLL0jXL7CC0IRLbpT9x 9dKw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si15611488plv.207.2018.10.20.02.00.28; Sat, 20 Oct 2018 02:00:44 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbeJTRJu (ORCPT + 99 others); Sat, 20 Oct 2018 13:09:50 -0400 Received: from mga03.intel.com ([134.134.136.65]:27767 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbeJTRJt (ORCPT ); Sat, 20 Oct 2018 13:09:49 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Oct 2018 02:00:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,403,1534834800"; d="scan'208";a="96889587" Received: from aaronlu.sh.intel.com (HELO intel.com) ([10.239.159.44]) by fmsmga002.fm.intel.com with ESMTP; 20 Oct 2018 02:00:03 -0700 Date: Sat, 20 Oct 2018 17:00:02 +0800 From: Aaron Lu To: Daniel Jordan Cc: Mel Gorman , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Huang Ying , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , Michal Hocko , Matthew Wilcox , Tariq Toukan , Jesper Dangaard Brouer Subject: Re: [RFC v4 PATCH 2/5] mm/__free_one_page: skip merge for order-0 page unless compaction failed Message-ID: <20181020090002.GA13858@intel.com> References: <20181017063330.15384-1-aaron.lu@intel.com> <20181017063330.15384-3-aaron.lu@intel.com> <20181017104427.GJ5819@techsingularity.net> <20181017131059.GA9167@intel.com> <20181017135807.GL5819@techsingularity.net> <20181017145904.GC9167@intel.com> <20181018111632.GM5819@techsingularity.net> <20181019055703.GA2401@intel.com> <20181019085435.GR5819@techsingularity.net> <20181019150053.iaubsdtcsi64mqb7@ca-dmjordan1.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181019150053.iaubsdtcsi64mqb7@ca-dmjordan1.us.oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 08:00:53AM -0700, Daniel Jordan wrote: > On Fri, Oct 19, 2018 at 09:54:35AM +0100, Mel Gorman wrote: > > On Fri, Oct 19, 2018 at 01:57:03PM +0800, Aaron Lu wrote: > > > > > > > > I don't think this is the right way of thinking about it because it's > > > > possible to have the system split in such a way so that the migration > > > > scanner only encounters unmovable pages before it meets the free scanner > > > > where unmerged buddies were in the higher portion of the address space. > > > > > > Yes it is possible unmerged pages are in the higher portion. > > > > > > My understanding is, when the two scanners meet, all unmerged pages will > > > be either used by the free scanner as migrate targets or sent to merge > > > by the migration scanner. > > > > > > > It's not guaranteed if the lower portion of the address space consisted > > entirely of pages that cannot migrate (because they are unmovable or because > > migration failed due to pins). It's actually a fundamental limitation > > of compaction that it can miss migration and compaction opportunities > > due to how the scanners are implemented. It was designed that way to > > avoid pageblocks being migrated unnecessarily back and forth but the > > downside is missed opportunities. > > > > > > You either need to keep unmerged buddies on a separate list or search > > > > the order-0 free list for merge candidates prior to compaction. > > > > > > > > > > It's needed to form them efficiently but excessive reclaim or writing 3 > > > > > > to drop_caches can also do it. Be careful of tying lazy buddy too > > > > > > closely to compaction. > > > > > > > > > > That's the current design of this patchset, do you see any immediate > > > > > problem of this? Is it that you are worried about high-order allocation > > > > > success rate using this design? > > > > > > > > I've pointed out what I see are the design flaws but yes, in general, I'm > > > > worried about the high order allocation success rate using this design, > > > > the reliance on compaction and the fact that the primary motivation is > > > > when THP is disabled. > > > > > > When THP is in use, zone lock contention is pretty much nowhere :-) > > > > > > I'll see what I can get with 'address space range' lock first and will > > > come back to 'lazy buddy' if it doesn't work out. > > With the address space range idea, wouldn't the zone free_area require changes > too? I can't see how locking by address range could synchronize it as it > exists now otherwise, with per order/mt list heads. > > One idea is to further subdivide the free area according to how the locking > works and find some reasonable way to handle having to search for pages of a > given order/mt in multiple places. I plan to create one free_are per 'address space range'. The challenge will be how to quickly locate a free_area that has the required free page on allocation path. Other details like how big the address space range should be etc. will need to be explored with testing. I think this approach is worth a try because it wouldn't cause fragmentation.