Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7096103rwd; Tue, 6 Jun 2023 06:23:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ATa/qlghfzQs21FSFeOLVgLiGw1Rjfq63V7ZG1TpUbtfj+77OqsPdrQ7MbpPHmEs4gYVQ X-Received: by 2002:a17:90a:2:b0:259:30e7:733c with SMTP id 2-20020a17090a000200b0025930e7733cmr2499829pja.21.1686057792675; Tue, 06 Jun 2023 06:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686057792; cv=none; d=google.com; s=arc-20160816; b=OxnZ5NUNr1p8HrlPMc/xeP1SHPCYwavunPcfq98+f+Z1AXYUp3iLJ9fru6r3/sbdwG ENQwePXcRT27RjiXblnV82zlOXs9vY54wDL4GmNOsa6N4vFo/wUzPlULNBXNlMp0Impz 3Xg/RJ2VEbF8rKdtT8dlba1jVB5aB4KAeFOghM/ejg8fj7AsWnyKr2WhsFZUjMy5uByP zEi7dg2904BwTzOT28ZRTie3e9MecqzlbfvWzNKPUPLrg7kGmTLD0iqVB5xWDybuBQ1p 4SiAIubtlufaX1CAqURCtwWk1wl3Yitv5Ei6Lh/x+tmTl/H8CStgQF3Gy72xWP12NqsP uneA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=OK2MXuNECGDPqZjzgWmkfkpBDGL9oo5X3x657WZQzkQ=; b=EjOBluZXbID8k6KTxK/VBzZDBwmO7QhSnPY4CdCJL0Jyd36QHEXyqg3xAsKxJQ6CoJ 9umojgwQ/1WCEzytBTL5jNr3T9KFbadMaXFRjaMBXdVRiAxujk4uL+IlsjGWHD9pWGCS 1KQpDeSPUuBuFIsZLwJlfTPX/dd3EFbUQgROfWyWcjTRz+xAGoKFcmcPeSnybVrB9CBR nIddamWQ0vD61l2N08u9/nujhRQWHHQEyo3MdLA5y/6CuzTavn5BgtCW/ezEx5Eq9K8h GOBuRJ+PKCv7eWHQ6Z8CXFq8IsNp8A8dl4wqcsh87palusQM1XnK/vhRdqHACzmdquZs bR/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Sb/NBavr"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=97PTe0rk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fu14-20020a17090ad18e00b00259b5211a16si6266pjb.103.2023.06.06.06.23.00; Tue, 06 Jun 2023 06:23:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="Sb/NBavr"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=97PTe0rk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237866AbjFFM73 (ORCPT + 99 others); Tue, 6 Jun 2023 08:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbjFFM7U (ORCPT ); Tue, 6 Jun 2023 08:59:20 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E84410F4 for ; Tue, 6 Jun 2023 05:58:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4D16B1FD69; Tue, 6 Jun 2023 12:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1686056328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OK2MXuNECGDPqZjzgWmkfkpBDGL9oo5X3x657WZQzkQ=; b=Sb/NBavrX9jHmuTQFxeQ9qYdZQf/zHtquhKvhHK82pROP9omA0OTf6E4kQFM8wn5toWyj9 r0/TztDOFtsKu2cLASCiAqCJBSpnwLMbAV7yt/uTjfTlaPZWEohD+m7G8yo/3XTv9/lO0+ BeVPi9sopC3bakb3uRu1cG8bX0VCnS4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1686056328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OK2MXuNECGDPqZjzgWmkfkpBDGL9oo5X3x657WZQzkQ=; b=97PTe0rkr3N5KOuUb6FflHjPTeTP08novX++g7/NvE1daNX2Qm8eXZOXEHo+uPp2rNFZ9M lwwwLHpMyA7f76Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 31ECB13776; Tue, 6 Jun 2023 12:58:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JcFqC4gtf2TuSwAAMHmgww (envelope-from ); Tue, 06 Jun 2023 12:58:48 +0000 Message-ID: <1296cd8a-fd28-98fe-b132-c168d46e3202@suse.cz> Date: Tue, 6 Jun 2023 14:58:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH 2/5] mm: compaction: simplify should_compact_retry() Content-Language: en-US To: Johannes Weiner Cc: Andrew Morton , Mel Gorman , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20230519123959.77335-1-hannes@cmpxchg.org> <20230519123959.77335-3-hannes@cmpxchg.org> <1c3c9305-a678-279e-f015-7aed544ab3c8@suse.cz> <20230529163805.GA84971@cmpxchg.org> <20230602144705.GB161817@cmpxchg.org> From: Vlastimil Babka In-Reply-To: <20230602144705.GB161817@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 6/2/23 16:47, Johannes Weiner wrote: > On Mon, May 29, 2023 at 12:38:07PM -0400, Johannes Weiner wrote: >> On Mon, May 29, 2023 at 03:03:52PM +0200, Vlastimil Babka wrote: >> > I think you simplified this part too much, so now once it runs out of >> > retries, it will return false, while previously it would increase the priority. > > Here is the delta fix. If this looks good to everybody, can you please > fold this into the patch you have in tree? Thanks! > > --- > From 4b9429f9ef04fcb7bb5ffae0db8ea113b26d097b Mon Sep 17 00:00:00 2001 > From: Johannes Weiner > Date: Fri, 2 Jun 2023 16:02:37 +0200 > Subject: [PATCH] mm: compaction: simplify should_compact_retry() fix > > Vlastimil points out an unintended change. Previously when hitting > max_retries we'd bump the priority level and restart the loop. Now we > bail out and fail instead. Restore the original behavior. > > Signed-off-by: Johannes Weiner For the 2/5 +fix Acked-by: Vlastimil Babka > --- > mm/page_alloc.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 72660e924b95..e7d7db36582b 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3768,6 +3768,15 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > if (fatal_signal_pending(current)) > return false; > > + /* > + * Compaction was skipped due to a lack of free order-0 > + * migration targets. Continue if reclaim can help. > + */ > + if (compact_result == COMPACT_SKIPPED) { > + ret = compaction_zonelist_suitable(ac, order, alloc_flags); > + goto out; > + } > + > /* > * Compaction managed to coalesce some page blocks, but the > * allocation failed presumably due to a race. Retry some. > @@ -3785,17 +3794,10 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, > if (order > PAGE_ALLOC_COSTLY_ORDER) > max_retries /= 4; > > - ret = ++(*compaction_retries) <= max_retries; > - goto out; > - } > - > - /* > - * Compaction was skipped due to a lack of free order-0 > - * migration targets. Continue if reclaim can help. > - */ > - if (compact_result == COMPACT_SKIPPED) { > - ret = compaction_zonelist_suitable(ac, order, alloc_flags); > - goto out; > + if (++(*compaction_retries) <= max_retries) { > + ret = true; > + goto out; > + } > } > > /*