Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp9646rdg; Wed, 11 Oct 2023 18:35:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFvf/ej0aMfMU4fr8eRlFHkGyAnXD0sL1BYCXD5zmNBZjvfkOhCL1PQ76vbUR2Jov2d1na X-Received: by 2002:a05:6a00:2d8c:b0:692:cede:c902 with SMTP id fb12-20020a056a002d8c00b00692cedec902mr22665373pfb.9.1697074539187; Wed, 11 Oct 2023 18:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697074539; cv=none; d=google.com; s=arc-20160816; b=mtIHckJIkEE3xUvYmgIcFguADcEyUfuVFdT/iRFYRZBfXjDp96SjQqxcztF2pfn3h2 SKgUzwGI41YxXGjVPiH/eaoGi9LRGN0pSrsTeI4ruJo79zjolgIicr79jzMsDaD0D4BH aionHukY7BBQ0D3UV7vd2pqHmVJim9JzZ9P5uOLxyW6gQbURDKotndR+SmfT5rPwbh+3 4yCRRAuy5JVs25BPtw2bO8J13AYplMKAWHktBLdzxIJp/AvRSCzuAG5zerP3DOUrD6BG B4i0UbLA2guPUSbBzs9WJgJAH05fDpbueyP2LXV1Edu4EwHVADhbex8c97UuxhbcyyWW b97w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:in-reply-to :mime-version:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=1xR0xaUS2PUNErqIs6W8I7g/oXEvEzevloTiZHy7yn8=; fh=MVHavElZi0K0rhF8B+oL4qY6AV7cFUE2na9P/xt8igw=; b=kpr+uTFshDXOd11Uyz7Zo1EyMlwskbuuoRGGUQ5u8gBn0cVWVQoaBdykPgBzvElwy0 p54/fek1zBaGoOtKpH4d2PLGj56ecVOGPDVTiswS0CzOiDwDyxSSS2QgszY5cOz4mDK5 3jhefVELi+xcXOYa28WKtmzgC3uKDEUkPe6Efx73me69uJyo0SlLNIOwemWCfFrlz5fI WjY8KwX/wf9OkaVCYw6HGsgfXFCi9eIXcGH290mhy5Mff+9IecagzjInvBnLV55w6tJO PQyt2uvO0LxvxEyGSnWoMAZDkbdvr5N6fXAGkE9RpSYUVhJ4usrTergz2hXeJGJHI6wD ADCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IKoc788u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fa40-20020a056a002d2800b00691023321ebsi13410434pfb.113.2023.10.11.18.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 18:35:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IKoc788u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E241280E06A5; Wed, 11 Oct 2023 18:35:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234004AbjJLBfc (ORCPT + 99 others); Wed, 11 Oct 2023 21:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233942AbjJLBfa (ORCPT ); Wed, 11 Oct 2023 21:35:30 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 502EFA9; Wed, 11 Oct 2023 18:35:28 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231012013526epoutp01e59c89fc5af0668280e12fe8ba3ce97b~NOEpGtKlD0928309283epoutp01W; Thu, 12 Oct 2023 01:35:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231012013526epoutp01e59c89fc5af0668280e12fe8ba3ce97b~NOEpGtKlD0928309283epoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1697074526; bh=1xR0xaUS2PUNErqIs6W8I7g/oXEvEzevloTiZHy7yn8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IKoc788ucqoX+1rYZ1cY79eSmMcmVwS0eghHQhGqrR/HLWyyIXB8MuWCfmDrDLXOj 8PMkLIgpnrHuEowSQRnCS5VVp08w3N/TXJuIlc+g+cHn/f3WnbyspdTGHjKAmE4SOC ntvhf0gBRuAolhMEHXfV4saUNE2DtPAg/JK10oDY= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20231012013525epcas2p3158e15e50f4fb96596c22fc76dae8717~NOEoglMye0540305403epcas2p3J; Thu, 12 Oct 2023 01:35:25 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.70]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4S5XJY0dVXz4x9QB; Thu, 12 Oct 2023 01:35:25 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 65.32.08583.C5D47256; Thu, 12 Oct 2023 10:35:24 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20231012013524epcas2p4b50f306e3e4d0b937b31f978022844e5~NOEndJu9D1929519295epcas2p4N; Thu, 12 Oct 2023 01:35:24 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231012013524epsmtrp2cfd5db0903a76b3b9fcc369c220eaacb~NOEnbUrc43128231282epsmtrp2s; Thu, 12 Oct 2023 01:35:24 +0000 (GMT) X-AuditID: b6c32a43-96bfd70000002187-a4-65274d5c25e7 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 9F.BE.18916.C5D47256; Thu, 12 Oct 2023 10:35:24 +0900 (KST) Received: from tiffany (unknown [10.229.95.142]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231012013524epsmtip227567c21b1e8eee7135c8fd96d927019~NOEnEBABz1669816698epsmtip2l; Thu, 12 Oct 2023 01:35:24 +0000 (GMT) Date: Thu, 12 Oct 2023 10:25:11 +0900 From: Hyesoo Yu To: Alexandru Elisei Cc: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com, pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH RFC 06/37] mm: page_alloc: Allocate from movable pcp lists only if ALLOC_FROM_METADATA Message-ID: <20231010074823.GA2536665@tiffany> MIME-Version: 1.0 In-Reply-To: <20230823131350.114942-7-alexandru.elisei@arm.com> X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xTVxzHc3pvb0sTumvBeYaJIXXqYANapPSAwIzAch2QgMvQ6Axr6A1F Sun62HQjoRAQ0A0ZpgqMsRIdoIJgeUl5KaCAypYgYHjpBoK8n2FOGWylF7f99znf8/2d7znn lx8XE3RznLixKh2tUcmUQoKH17a5SNw+C9tHi8anDqCCijICXb72mEDNndFoPec+B/WM9Vml qWQcLRR/C9BqxWsMjWfXYOiuaR5H48tZOHrWXMJCIxeMOKqbmGOh6eo2HGVYVnFkHutno8am Lhw9thQQ6GnZ32zUXtGNo/qCLja6OD8B0JWSvajnjomFjK9mCXRh+AmBOr67w0LNGb+xrN46 FkpuXyBQ3tAQQBntf2CoaeMVjmruveSg1GEJGvi5knNwD1VWWAaotdc5gEptHuRQJrOeSm2f Y1NVpa6U+XomQZmXczjUcH8jQXXmruFUkcGIUVVXk6jJqjxALTT3EVTVw2+oFfOucPJ4nJ+C lslpjTOtik6Qx6pi/IUhn0QFRkm8RWI3sQ+SCp1VsnjaXxgUGu72UazS+plC5y9lSr1VCpdp tUKPAD9Ngl5HOysStDp/Ia2WK9VStbtWFq/Vq2LcVbTOVywSeUqsxs/jFJaLtUB9aedpSwbX AFa3nwN2XEh6wd97zWCTBeRtALP6decAz8rLAE49qGcxG9bFYvfhNwU9lZUEY6oH8HmKkc0s xgGsXMvlbLpwcg8sMI4Qm0yQ+2BndbEtwpH0gKM102CzACMfEHDkh0e2CAdSCbNHLTaTPekO W7PmOAxvg115z/FNtiM/hDNLf9miIXmWB8cKmTRIBsGmzCWcYQc43VG9pTvBlfkmguE4OLKU vcU6ePORYcuzH+ZPpFuDudYbKaC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5BsZ2s6y7sOUyy/YBGw42PnKXbQ9phgv62x4mxnczV7t7MRsHO+axTbebmKXeQ3f8B8nPiG ktOoyzh9xpsFiYWOyGdANwbL+6KqGvBTkgkk0JDJgsGODsoEEmkR4wXQ5blKrILnoX1xCFvN SXDS6CdXR2EAb85PgTggmFTYZL1NxTPFSOFgV8tKn8xkwJBnGsQFnAlQ0HzWTsZBEqOBDaHe lZGQkcF+84wgnkWMAX5+L0yu9uvgUOPvK1fgTDr8JTa1fAW9nMXQGaPjdQKzA97742+qATD2 pwz7U4b9f8MBcBd4jtMZtCqtQpcpM8i1htISlUxxQMuDlb9Jz+0BLe1PZP0Ao0E/gDQuSRaG 1C9zIqFSXlHJ6Q/s15dqOEM/ENOEZIPwJc1hpYhRyQ9yxRyn4/T/UYxO2FiDvaBaU2dV9dhO qH/md7UqLdrtRdHgiUlX0akPd1bkGPeMDgtHy5Nbs2XBurVdWe+kVRcETp/c7XWuZz6qzNvm lZpYbuG747ni78ttgRyxdkC8Q2jc8G7bpipTYJdLPV+Zs9dtya0K6B/MVsSyj4+WpfmmhdZD EzUdfHHGdl01H322+be1qVcv54+4wLBh59ZP9+ZtKjokPWqyQOWL643Jadr58i1V+e8X21Js EQqv80zEIsSain1vXSkuMF1PUf/V5/Wnut4uM0dLqz3I8/pdUvHa+NjwGZLmpebMpcI9D+o2 Lz6zX5EX+uToF+F9Z53M/e7uUG3z1/WZzW3dWTMSwlAoz0zH9Qb5v3q2daWmAwAA X-CMS-MailID: 20231012013524epcas2p4b50f306e3e4d0b937b31f978022844e5 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----W0Xmz0KnCHm4AUy7D1SfHXLrd_ueEv6xw0V41DtFjSLTJg.k=_d8fad_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231012013524epcas2p4b50f306e3e4d0b937b31f978022844e5 References: <20230823131350.114942-1-alexandru.elisei@arm.com> <20230823131350.114942-7-alexandru.elisei@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 18:35:38 -0700 (PDT) ------W0Xmz0KnCHm4AUy7D1SfHXLrd_ueEv6xw0V41DtFjSLTJg.k=_d8fad_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Wed, Aug 23, 2023 at 02:13:19PM +0100, Alexandru Elisei wrote: > pcp lists keep MIGRATE_METADATA pages on the MIGRATE_MOVABLE list. Make > sure pages from the movable list are allocated only when the > ALLOC_FROM_METADATA alloc flag is set, as otherwise the page allocator > could end up allocating a metadata page when that page cannot be used. > > __alloc_pages_bulk() sidesteps rmqueue() and calls __rmqueue_pcplist() > directly. Add a check for the flag before calling __rmqueue_pcplist(), and > fallback to __alloc_pages() if the check is false. > > Note that CMA isn't a problem for __alloc_pages_bulk(): an allocation can > always use CMA pages if the requested migratetype is MIGRATE_MOVABLE, which > is not the case with MIGRATE_METADATA pages. > > Signed-off-by: Alexandru Elisei > --- > mm/page_alloc.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 829134a4dfa8..a693e23c4733 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -2845,11 +2845,16 @@ struct page *rmqueue(struct zone *preferred_zone, > > if (likely(pcp_allowed_order(order))) { > /* > - * MIGRATE_MOVABLE pcplist could have the pages on CMA area and > - * we need to skip it when CMA area isn't allowed. > + * PCP lists keep MIGRATE_CMA/MIGRATE_METADATA pages on the same > + * movable list. Make sure it's allowed to allocate both type of > + * pages before allocating from the movable list. > */ > - if (!IS_ENABLED(CONFIG_CMA) || alloc_flags & ALLOC_CMA || > - migratetype != MIGRATE_MOVABLE) { > + bool movable_allowed = (!IS_ENABLED(CONFIG_CMA) || > + (alloc_flags & ALLOC_CMA)) && > + (!IS_ENABLED(CONFIG_MEMORY_METADATA) || > + (alloc_flags & ALLOC_FROM_METADATA)); > + > + if (migratetype != MIGRATE_MOVABLE || movable_allowed) { Hi! I don't think it would be effcient when the majority of movable pages do not use GFP_TAGGED. Metadata pages have a low probability of being in the pcp list because metadata pages is bypassed when freeing pages. The allocation performance of most movable pages is likely to decrease if only the request with ALLOC_FROM_METADATA could be allocated. How about not including metadata pages in the pcp list at all ? Thanks, Hyesoo Yu. > page = rmqueue_pcplist(preferred_zone, zone, order, > migratetype, alloc_flags); > if (likely(page)) > @@ -4388,6 +4393,14 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > goto out; > gfp = alloc_gfp; > > + /* > + * pcp lists puts MIGRATE_METADATA on the MIGRATE_MOVABLE list, don't > + * use pcp if allocating metadata pages is not allowed. > + */ > + if (metadata_storage_enabled() && ac.migratetype == MIGRATE_MOVABLE && > + !(alloc_flags & ALLOC_FROM_METADATA)) > + goto failed; > + > /* Find an allowed local zone that meets the low watermark. */ > for_each_zone_zonelist_nodemask(zone, z, ac.zonelist, ac.highest_zoneidx, ac.nodemask) { > unsigned long mark; > -- > 2.41.0 > > ------W0Xmz0KnCHm4AUy7D1SfHXLrd_ueEv6xw0V41DtFjSLTJg.k=_d8fad_ Content-Type: text/plain; charset="utf-8" ------W0Xmz0KnCHm4AUy7D1SfHXLrd_ueEv6xw0V41DtFjSLTJg.k=_d8fad_--