Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp321017rdf; Tue, 21 Nov 2023 03:54:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKf1YRfi/fjiScAXjWBp9uxmcZFVD/a5GiU63e4vlQtXo9B7N5WsLS9DDwCQ/OfOLO3Ue6 X-Received: by 2002:a05:6a21:3384:b0:187:f7d3:fe4 with SMTP id yy4-20020a056a21338400b00187f7d30fe4mr8375865pzb.11.1700567699251; Tue, 21 Nov 2023 03:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700567699; cv=none; d=google.com; s=arc-20160816; b=L3pxAYwk97IEYMWm2SizUTrzyjF/HDF23Ir/Mxwxf9RLGHgU/AGvBnFWaGpf5CzfMP qs4lev0q+wgOxXutopUfSiDnbaetonxVWhd1P4dxDaslWd7agtQC5Uqby8b7H7AlVmb1 c2W0HA+qg7PpGexnX2Jju0JY32qOmxZKqZg63d6FDn5fG1Hha5aDqfzB34KJEq86Yt7E DmpHZav9wXt2z2RWKKdBdQSoGQ9k15JlTt8k4wX4l6e427pWBLRsepSCqkwp7Jpjz9X4 kfDiYghjp8HWuSDj04v7j3q8Bq9FYkv2BVV3+G3J9Md7eJCGTd8gO24hCrQA+J5ck6Qx /NMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rqxL6K+cTlELevNWyEflUlyYLGy0VWXMk7LIi+/+/3g=; fh=kiFa6QFgiDV9fTIRXvv7bZ3FmftpxgjwL8zUt1AKL6k=; b=YX5WDiwMP8kDPUpW1leIHUYK1bKBGeeCRBXPG1UjC3v879n8QOc48aX45LhUBlmZI1 AmyMXQzdXgzsoq3F6OBoVUXIuqWGVVrL3F9lMaRepDtDBDOw2FKJ1EnFbY+7QPc/wLW/ 9vdz65hiA2u1tHxRcHXMLfPc6Lfsilx1C7TOQ3UXW1B7y6xORaQeuuv8mDRmIwwv1mCl YBWg2t48zyrE7H0VitlOfGmbli82QoReqqbiSQ1160Os1cpEfiypGNn6Ut+zZJ5S43Cz EYIk80KAN8uEhz/u6HhdDO4WLg5oCwdPDlqOlhzDVQnj+biyPOpfJBno1hAUAx7sg1YQ zhEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i8-20020a17090332c800b001cc6afede42si10541833plr.354.2023.11.21.03.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 03:54:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 898FB80475CD; Tue, 21 Nov 2023 03:54:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234198AbjKULyu (ORCPT + 99 others); Tue, 21 Nov 2023 06:54:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233685AbjKULys (ORCPT ); Tue, 21 Nov 2023 06:54:48 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78170122; Tue, 21 Nov 2023 03:54:43 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BBD48FEC; Tue, 21 Nov 2023 03:55:29 -0800 (PST) Received: from arm.com (e121798.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD1103F7A6; Tue, 21 Nov 2023 03:54:38 -0800 (PST) Date: Tue, 21 Nov 2023 11:54:36 +0000 From: Alexandru Elisei To: Peter Collingbourne 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, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.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 20/37] mm: compaction: Reserve metadata storage in compaction_alloc() Message-ID: References: <20230823131350.114942-1-alexandru.elisei@arm.com> <20230823131350.114942-21-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 03:54:56 -0800 (PST) Hi Peter, On Mon, Nov 20, 2023 at 08:49:32PM -0800, Peter Collingbourne wrote: > Hi Alexandru, > > On Wed, Aug 23, 2023 at 6:16 AM Alexandru Elisei > wrote: > > > > If the source page being migrated has metadata associated with it, make > > sure to reserve the metadata storage when choosing a suitable destination > > page from the free list. > > > > Signed-off-by: Alexandru Elisei > > --- > > mm/compaction.c | 9 +++++++++ > > mm/internal.h | 1 + > > 2 files changed, 10 insertions(+) > > > > diff --git a/mm/compaction.c b/mm/compaction.c > > index cc0139fa0cb0..af2ee3085623 100644 > > --- a/mm/compaction.c > > +++ b/mm/compaction.c > > @@ -570,6 +570,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > > bool locked = false; > > unsigned long blockpfn = *start_pfn; > > unsigned int order; > > + int ret; > > > > /* Strict mode is for isolation, speed is secondary */ > > if (strict) > > @@ -626,6 +627,11 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > > > > /* Found a free page, will break it into order-0 pages */ > > order = buddy_order(page); > > + if (metadata_storage_enabled() && cc->reserve_metadata) { > > + ret = reserve_metadata_storage(page, order, cc->gfp_mask); > > At this point the zone lock is held and preemption is disabled, which > makes it invalid to call reserve_metadata_storage. You are correct, I missed that. I dropped reserving tag storage during compaction in the next iteration, so fortunately I unintentionally fixed it. Thanks, Alex > > Peter > > > + if (ret) > > + goto isolate_fail; > > + } > > isolated = __isolate_free_page(page, order); > > if (!isolated) > > break; > > @@ -1757,6 +1763,9 @@ static struct folio *compaction_alloc(struct folio *src, unsigned long data) > > struct compact_control *cc = (struct compact_control *)data; > > struct folio *dst; > > > > + if (metadata_storage_enabled()) > > + cc->reserve_metadata = folio_has_metadata(src); > > + > > if (list_empty(&cc->freepages)) { > > isolate_freepages(cc); > > > > diff --git a/mm/internal.h b/mm/internal.h > > index d28ac0085f61..046cc264bfbe 100644 > > --- a/mm/internal.h > > +++ b/mm/internal.h > > @@ -492,6 +492,7 @@ struct compact_control { > > */ > > bool alloc_contig; /* alloc_contig_range allocation */ > > bool source_has_metadata; /* source pages have associated metadata */ > > + bool reserve_metadata; > > }; > > > > /* > > -- > > 2.41.0 > >