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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 1629EC10DCE for ; Sun, 8 Mar 2020 13:23:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C90120828 for ; Sun, 8 Mar 2020 13:23:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C90120828 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BC6A6B0005; Sun, 8 Mar 2020 09:23:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 845B46B0006; Sun, 8 Mar 2020 09:23:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70EF26B0007; Sun, 8 Mar 2020 09:23:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 558C76B0005 for ; Sun, 8 Mar 2020 09:23:18 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 210BD8248047 for ; Sun, 8 Mar 2020 13:23:18 +0000 (UTC) X-FDA: 76572261276.09.door97_7418dc649b310 X-HE-Tag: door97_7418dc649b310 X-Filterd-Recvd-Size: 3863 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Sun, 8 Mar 2020 13:23:17 +0000 (UTC) Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jAvtb-00042O-AD; Sun, 08 Mar 2020 09:23:07 -0400 Message-ID: <2f3e2cde7b94dfdb8e1f0532d1074e07ef675bc4.camel@surriel.com> Subject: Re: [PATCH] mm,page_alloc,cma: conditionally prefer cma pageblocks for movable allocations From: Rik van Riel To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Roman Gushchin , Qian Cai , Vlastimil Babka , Mel Gorman , Anshuman Khandual Date: Sun, 08 Mar 2020 09:23:06 -0400 In-Reply-To: <20200307143849.a2fcb81a9626dad3ee46471f@linux-foundation.org> References: <20200306150102.3e77354b@imladris.surriel.com> <20200307143849.a2fcb81a9626dad3ee46471f@linux-foundation.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Zfoz2TVd9hG/2oLi3xrD" User-Agent: Evolution 3.34.3 (3.34.3-1.fc31) MIME-Version: 1.0 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: --=-Zfoz2TVd9hG/2oLi3xrD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2020-03-07 at 14:38 -0800, Andrew Morton wrote: > On Fri, 6 Mar 2020 15:01:02 -0500 Rik van Riel > wrote: > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -2711,6 +2711,18 @@ __rmqueue(struct zone *zone, unsigned int > > order, int migratetype, > > { > > struct page *page; > > =20 > > + /* > > + * Balance movable allocations between regular and CMA areas by > > + * allocating from CMA when over half of the zone's free memory > > + * is in the CMA area. > > + */ > > + if (migratetype =3D=3D MIGRATE_MOVABLE && > > + zone_page_state(zone, NR_FREE_CMA_PAGES) > > > + zone_page_state(zone, NR_FREE_PAGES) / 2) { > > + page =3D __rmqueue_cma_fallback(zone, order); > > + if (page) > > + return page; > > + } > > retry: > > page =3D __rmqueue_smallest(zone, order, migratetype); > > if (unlikely(!page)) { >=20 > __rmqueue() is a hot path (as much as any per-page operation can be a > hot path). What is the impact here? That is a good question. For MIGRATE_MOVABLE allocations, most allocations seem to be order 0, which go through the per cpu pages array, and rmqueue_pcplist, or be order 9. For order 9 allocations, other things seem likely to dominate the allocation anyway, while for order 0 allocations the pcp list should take away the sting? What I do not know is how much impact this change would have on other allocations, like order 3 or order 4 network buffer allocations from irq context... Are there cases in particular that we should be testing? --=20 All Rights Reversed. --=-Zfoz2TVd9hG/2oLi3xrD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl5k8boACgkQznnekoTE 3oNzDgf/b23t5rPuQYzgUxsXx9l2rT+R+nlh3KEN+PXzObY/1EEk69KwFipsvq63 iNRVN55lIjGtBWyvwEbqh1ZLV1vO2k0uTfJ7z5HfVCJrlyyOdnMGZJcxE+9ifsSJ MKXMaXMy0U29MoqLFq/8Z1QizRRTk6/nr6X7mirpECfKqrCLTfg9Esixde9aIcQc vbIZDo9rwEvUG5Ig226VOLBO75mAOJrvXUUZ0ctrs51vnhjLYEhvNNhHIOP3Qlv2 2bE0oXgRBvD29ka8CbjYrljeD8clZ2xKJ2DVb/ZZWUlqFV+vTGUnHuEE9lvIYD8D bYGt2r05+IMc7thEzDEqKa3QY8N87w== =HNtA -----END PGP SIGNATURE----- --=-Zfoz2TVd9hG/2oLi3xrD--