Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp944458ybg; Wed, 10 Jun 2020 18:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhO3Pk8UTbXYmPZqi8Twhu2xFYgrZtUlDlIqKhBBvZFfqoSmlsiJaomHD5UbW7NB7xZ5VQ X-Received: by 2002:a17:906:2c1a:: with SMTP id e26mr6063402ejh.514.1591840064337; Wed, 10 Jun 2020 18:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591840064; cv=none; d=google.com; s=arc-20160816; b=XHoBt0vG1k/5M0gHGaraa60AqBI3xHNMHb3PHsKMlGbT2NmLPptw4HOWCtrtn6XJCw vm1dEH/ZPPixIqxFwJUNJuQbAdQPUyuEkZO1V7UabXp/hcI9xVoYmLWuHCaWurwyya0S cfr/XXHgwlXwycWC7KeZOfoFl5izbi7bJS3MY1P6MxFkKmV/4h6uV7Qn9TWHoa0TlMdv 58OvmYo+URJp7nIfaNgF/M9KcUZxVaIrGYXdTIiEo+UmeCEWIzH/kSHyUNTr7tAVSY18 OHO8b+fr+u+Bz2GV2hKeUmBpmcjZ1ySGvOswCr2/2VZZrw2KQcMG8czOhzK+jS1WoufN jbWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=IXq3Fhg8fJgbzV9gLay0eeT5K9GzGHQPNtgl6WtI5fQ=; b=D+wu7WsgprF1pDMX9wO5wjhKCaWsuEqJFPFHvuETGJHWEYHSzbWlUxV+S5yAT4ne5e S/pwUvDvgqfOYtJrh6ng+N5zZ2f5yNF+c9R1okC5Vw7/mkWTiBd5WGY0nBhjqYMkP+Wu 3HWwC98TpyO7RvctywgeXW1Pkj/ODOK1GM9U+86QG99CJ1ZWRTBxR3dxyFUYARs0Nz6+ s/mKzwiv5SGg77afEsoKZuHuHszVKYqMgUdSin95XDj3yEtI5uOZCf38W87ANeVu5P6j B4WxWGLgWtCn8GzKnfnrb3FClRjAQPQM07zSk5evttXqVvfmdASPDivnIrxHcgILUL4X SIfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cCqXHmSo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si797456eds.13.2020.06.10.18.47.21; Wed, 10 Jun 2020 18:47:44 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cCqXHmSo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726407AbgFKBnk (ORCPT + 99 others); Wed, 10 Jun 2020 21:43:40 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36165 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbgFKBnj (ORCPT ); Wed, 10 Jun 2020 21:43:39 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200611014336epoutp040aa0d6d94b5334a06ca455655817f60e~XWeETKmx70592005920epoutp04E for ; Thu, 11 Jun 2020 01:43:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200611014336epoutp040aa0d6d94b5334a06ca455655817f60e~XWeETKmx70592005920epoutp04E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1591839816; bh=IXq3Fhg8fJgbzV9gLay0eeT5K9GzGHQPNtgl6WtI5fQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=cCqXHmSorpDioaOoqMsOZBPSZLCr+yIZeVFy1XuTCcS7OMwFzIEyZIppq/nenL7mI R2iVJcAhtxaEyi8qvq6GyUeyF3rvPGFt0X/1j1xi+xbaNDfk+E2w4PVYeYi5EKLCa0 eQgCqqhB/LomU5i2GDx2wz0w4yHb8anI/DC77y54= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20200611014335epcas1p11bd9541fd35eee3f5f095eba35b842fb~XWeDfClw30870908709epcas1p1o; Thu, 11 Jun 2020 01:43:35 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.40.161]) by epsnrtp1.localdomain (Postfix) with ESMTP id 49j6865RgMzMqYlt; Thu, 11 Jun 2020 01:43:34 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 12.F6.18978.64C81EE5; Thu, 11 Jun 2020 10:43:34 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20200611014334epcas1p389f55a80344b4066e4685038bfc5054a~XWeCJyWY42553325533epcas1p3D; Thu, 11 Jun 2020 01:43:34 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200611014334epsmtrp25b378b9fbd7e4481c1ecf93711573b5e~XWeCI-el91129911299epsmtrp2_; Thu, 11 Jun 2020 01:43:34 +0000 (GMT) X-AuditID: b6c32a35-5edff70000004a22-e2-5ee18c463439 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 07.05.08382.64C81EE5; Thu, 11 Jun 2020 10:43:34 +0900 (KST) Received: from [10.253.104.82] (unknown [10.253.104.82]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200611014332epsmtip2bac26047a77080ecb4f71e6b06f46fbf~XWeAuU-Dk0859408594epsmtip2P; Thu, 11 Jun 2020 01:43:32 +0000 (GMT) Subject: Re: [PATCH] page_alloc: consider highatomic reserve in wmartermark fast To: Mel Gorman , Baoquan He Cc: 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 From: Jaewon Kim Message-ID: <5EE18C38.3090601@samsung.com> Date: Thu, 11 Jun 2020 10:43:20 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20200609151330.GL3127@techsingularity.net> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOJsWRmVeSWpSXmKPExsWy7bCmnq5bz8M4g8XbtC3mrF/DZnH+wS82 i5XzzrFZrN7ka9G9eSajxeVdc9gs7q35z2ox+d0zRosdS/cxWSz7+p7d4vF6bgduj8Nv3jN7 7Jx1l91j06pONo9Nnyaxe5yY8ZvF4/2+q2wefVtWMXpsPl3tsfWXncfnTXIBXFE5NhmpiSmp RQqpecn5KZl56bZK3sHxzvGmZgaGuoaWFuZKCnmJuam2Si4+AbpumTlA9yoplCXmlAKFAhKL i5X07WyK8ktLUhUy8otLbJVSC1JyCgwNCvSKE3OLS/PS9ZLzc60MDQyMTIEqE3Iyvk2dy1Zw WqDi9JFjzA2MO3i7GDk5JARMJJr2b2PuYuTiEBLYwSjRt301G4TziVHi36kdUM43RolzPd9Y YVq+rv4FldjLKPH20h4WCOcto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GD02n6722PrLzuPzJrkArigum5TUnMyy 1CJ9uwSujG9T57IVnBaoOH3kGHMD4w7eLkZODgkBE4mvq3+xdTFycQgJ7GaUuPt3EStEQkbi zfmnLF2MHEC2sMThw8UQNa8ZJT4+284CUiMsECSx5uZ0ZhBbRMBT4tS9B6wQRc8ZJe70n2QG cZgFLjFKtO4/wAZSxSagLfF+wSSwDbwCWhJfJ8wBs1kEVCVezznPDmKLCkRIrF53jRmiRlDi 5MwnYNs4BSwk/nQuYAa5iFlAXWL9PCGQMLOAvETz1tnMExgFZyHpmIVQNQtJ1QJG5lWMkqkF xbnpucWGBYZ5qeV6xYm5xaV56XrJ+bmbGMFxpaW5g3H7qg96hxiZOBgPMUpwMCuJ8AqKP4wT 4k1JrKxKLcqPLyrNSS0+xCjNwaIkznujcGGckEB6YklqdmpqQWoRTJaJg1OqgWl9/eXHzfeP Tb7Prbxsf0ZksUHN7DLR/Y3XJ/7cs4pHYmu48M7/edL6eyaI+ZUbrovf032SV2fNkh/uEgqz G+Lk6o3+aV5ZPH0j053Wf+wvDh1P102Nn3ho7tXHr1gYIi7/XNsTs9aC1VvTJLsnflpjcrrP gVXvcyuT0sKTJ5utjT4adO/+0blqEsvCHsTdVvjEHnxjpre3Gc/V36U288W8uu88iFjSezx+ Z9oNh+nMz2JO2Rze1ZvRtu3d/jPijecYTptn/SkXPfRG2z3q0H2Op0tSPKLFo794zzLYvpUp ahXfUl7hM5tv7vp8UTH9iWVEtnz5buXVXfY3C/LfG0zl+8NyeKEtr3VJF9us1cpKLMUZiYZa zEXFiQDDFUGDGgMAAA== X-CMS-MailID: 20200611014334epcas1p389f55a80344b4066e4685038bfc5054a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200609095139epcas1p17f9c213de6daf25fe848921bc70481c0 References: <20200609095128.8112-1-jaewon31.kim@samsung.com> <20200609142747.GA3346@MiWiFi-R3L-srv> <20200609151330.GL3127@techsingularity.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020년 06월 10일 00:13, Mel Gorman wrote: > 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. Hello Baoquan Thank you for the review. I may change code to high_zoneidx in next version. By the way let me consider Minchan's comment regarding sharing code. >> > That's fine, I simply wanted to illustrate where I thought the check > should go to minimise the impact to the majority of allocations. Hello Mel. Can I understand that you also agrees on checking highatomic reserved? Additionally I've wondered why the number of highatomic free pages is not accurately counted like cma free. Is there any concern on counting it? > Thank you Jaewon Kim