From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 939CCC433DF for ; Tue, 9 Jun 2020 15:13:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4918B207C3 for ; Tue, 9 Jun 2020 15:13:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4918B207C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BFC2A6B0005; Tue, 9 Jun 2020 11:13:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD2616B0007; Tue, 9 Jun 2020 11:13:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0E536B0008; Tue, 9 Jun 2020 11:13:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 986106B0005 for ; Tue, 9 Jun 2020 11:13:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5D1748087F5C for ; Tue, 9 Jun 2020 15:13:34 +0000 (UTC) X-FDA: 76910017548.29.rake62_220eee526dc3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 2E1FC184E3E42 for ; Tue, 9 Jun 2020 15:13:34 +0000 (UTC) X-HE-Tag: rake62_220eee526dc3 X-Filterd-Recvd-Size: 3253 Received: from outbound-smtp15.blacknight.com (outbound-smtp15.blacknight.com [46.22.139.232]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Jun 2020 15:13:33 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp15.blacknight.com (Postfix) with ESMTPS id DA15E1C3B55 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) X-Rspamd-Queue-Id: 2E1FC184E3E42 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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