Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp709538ybg; Tue, 9 Jun 2020 10:49:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWLK66imKMDAN5BF5bLDgIZsYhP514spk7aPTpUSbdphmoUk2Pnuk1OqdJ+l8MlzG6lxWJ X-Received: by 2002:a17:906:fc13:: with SMTP id ov19mr26209252ejb.212.1591724961931; Tue, 09 Jun 2020 10:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591724961; cv=none; d=google.com; s=arc-20160816; b=I5qaapZzlcpQ2bi3G4sQ37paiqb/H8Sul37x/Q0bbin2jbPNFwea1MAXIfncbrDqEf s/FMJY3T2PSmBo9CtpLCIJRCDXO2lnRsqIlqXgh1t1nQwMHCueFT5o5lGNqz4ZHuMgn8 Demqg1RIzVqjlCZolVNMEQNGEB0UkyXpV7/M/nnUy89UADmOwHhDdIZv6KYSYdfC/n4a ay8XB1ZzEO8nVu/BRsPavjHOhsueWRJQ5CM+ZDJRR+/iu7vu2SNPcWDLYCFDcm3LUFrc WZOKqOwrOlwbJYV6ttPLIgkirOeJH0Z7sE17n1GS8m3+Xe8FBxj70X3dXpm5iZEdGQnf ekfA== 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=drxq2avw1/xJLr7vCrY2HD1YoARE2bGVvRjrc8KVtSQ=; b=UMk1Aj8yhe+nu3kgc4ky8Js8bellZnlEMj8QO+4OOIA8S/9ZenHThMTpOzYTucIz/X 1h80qBOTicGK87+mJ1Uql9yfPTa4/iD2fFCmKtyu8jZ6MuSYPk/KjgiowY7e1ZQfU0Aq ts81v1hNZnxRqaUHlaDPTBG1Ks3lDO80dKXV1cWMjKY/ZYuk8o224rD4/5gy3kIPUS0t br/NmlqX7ehN5jYoOB3yYGP9BTWaJxWCM8IDS2UiWzHiRdthAsfCqE+POOxurYZsym5v 5iDnYs/ijCgTF2E9vVHazXYaI5M+MOQOB3E752W82MGKARIl2BTCSLb20drvuWqR8JMI 7Tzw== ARC-Authentication-Results: i=1; mx.google.com; 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 mf1si11258427ejb.225.2020.06.09.10.48.58; Tue, 09 Jun 2020 10:49:21 -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; 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 S1730748AbgFIPNh (ORCPT + 99 others); Tue, 9 Jun 2020 11:13:37 -0400 Received: from outbound-smtp42.blacknight.com ([46.22.139.226]:44325 "EHLO outbound-smtp42.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730737AbgFIPNe (ORCPT ); Tue, 9 Jun 2020 11:13:34 -0400 Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp42.blacknight.com (Postfix) with ESMTPS id DCA6B1AFF for ; Tue, 9 Jun 2020 16:13:31 +0100 (IST) Received: (qmail 5930 invoked from network); 9 Jun 2020 15:13:31 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.18.57]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 9 Jun 2020 15:13:31 -0000 Date: Tue, 9 Jun 2020 16:13:30 +0100 From: Mel Gorman To: Baoquan He Cc: Jaewon Kim , minchan@kernel.org, mgorman@suse.de, hannes@cmpxchg.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, ytk.lee@samsung.com, cmlaika.kim@samsung.com Subject: Re: [PATCH] page_alloc: consider highatomic reserve in wmartermark fast Message-ID: <20200609151330.GL3127@techsingularity.net> References: <20200609095128.8112-1-jaewon31.kim@samsung.com> <20200609142747.GA3346@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20200609142747.GA3346@MiWiFi-R3L-srv> 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 Tue, Jun 09, 2020 at 10:27:47PM +0800, Baoquan He wrote: > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 13cc653122b7..00869378d387 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -3553,6 +3553,11 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order, > > { > > long free_pages = zone_page_state(z, NR_FREE_PAGES); > > long cma_pages = 0; > > + long highatomic = 0; > > + const bool alloc_harder = (alloc_flags & (ALLOC_HARDER|ALLOC_OOM)); > > + > > + if (likely(!alloc_harder)) > > + highatomic = z->nr_reserved_highatomic; > > > > #ifdef CONFIG_CMA > > /* If allocation can't use CMA areas don't use free CMA pages */ > > @@ -3567,8 +3572,12 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order, > > * the caller is !atomic then it'll uselessly search the free > > * list. That corner case is then slower but it is harmless. > > */ > > - if (!order && (free_pages - cma_pages) > mark + z->lowmem_reserve[classzone_idx]) > > - return true; > > + if (!order) { > > + long fast_free = free_pages - cma_pages - highatomic; > > + > > + if (fast_free > mark + z->lowmem_reserve[classzone_idx]) > > This looks reasonable to me. However, this change may not be rebased on > top of the latest mainline tree or mm tree. E.g in this commit 97a225e69a1f8 > ("mm/page_alloc: integrate classzone_idx and high_zoneidx"), classzone_idx > has been changed to highest_zoneidx. > That's fine, I simply wanted to illustrate where I thought the check should go to minimise the impact to the majority of allocations. -- Mel Gorman SUSE Labs