Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3284581rdb; Wed, 13 Sep 2023 07:42:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ3XMqNAHOpW/62063m/r3g71AoE8s6jR6PRblqr19nvSWcNFiTgHrgS8HbU5YbOSuM7em X-Received: by 2002:aa7:88c3:0:b0:68f:e245:3aa5 with SMTP id k3-20020aa788c3000000b0068fe2453aa5mr3165187pff.33.1694616140753; Wed, 13 Sep 2023 07:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694616140; cv=none; d=google.com; s=arc-20160816; b=YJZ6Xv4akKK2p1v0tLGx61fUFFuhy+zPS1OaU5NN3+bm90mVnV7i3r5Rs4s+OaVRNu 2j4bHGIDnpiHe7PVHvJABH1pssAry8vA0kaP3T0ANh41W5Fz3yYsKFJ0DyxywncSnvGS njd3Yu8nkNU5OFH0kryuuy6SElzLE5LArXXAmATOP7Uawxyc8bagJFY2j/v01jRv2CSG 9LcpMukdKzPqwcnsaw/MnMYgBObarWIWVCnRCdqB2iOTluiiQ0ReodVngDF3pkzS5kY8 fkrilGfxJqZMchahR42SIWDL6SiTr+NeGJYqowBrcsJZod0Y7FMtumK4x6QV5E7NDZOH hhHw== 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=6QLGLoGaoJqwtkP43V8jHsqGgwi0QsZKKA9ML65E+YI=; fh=hq15/A2Tslw9YA2204Su5Ecu43xpuzUCtL6/M8x+dIs=; b=ngtIm2Xr377eXgue3FPN1zDJpfiegd5ep1RBOimYj9haIyRXk3NONYe6kZ+6nGpJ// IXtzAtDBcwMNTPUq/C3MJrWMWhy+UHIhiY2Ct+X98Gi5plVMWAg7VuRe1FaqYGsQFrYt WfCpKFIu9uugUUwRwXif86lTNa1n20fcdokweEdzdj2NUtjQLjTAO9/2QLeaFYcnGRXY z1NZBL2AQ53kKMhXHCjN+qYdRTUyZ2ofQxPvRhikyrVOU04s0wjy9Ou+7NrSKPHx3wTY ml/CDGFc/fGI4D3K/LrzPeNUeuYOOyRf2L0uVu9xq7/Y+z3F6IW+Vn6bJ7p9zaplenmS Eh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dX3aadPx; dkim=neutral (no key) header.i=@suse.cz header.b=9tVGc6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d15-20020aa7868f000000b0068c0070d15esi9897972pfo.87.2023.09.13.07.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 07:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dX3aadPx; dkim=neutral (no key) header.i=@suse.cz header.b=9tVGc6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4D3428087259; Wed, 13 Sep 2023 07:40:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240038AbjIMOkz (ORCPT + 99 others); Wed, 13 Sep 2023 10:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232390AbjIMOky (ORCPT ); Wed, 13 Sep 2023 10:40:54 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A4D190 for ; Wed, 13 Sep 2023 07:40:50 -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 EC2961F390; Wed, 13 Sep 2023 14:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1694616048; 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=6QLGLoGaoJqwtkP43V8jHsqGgwi0QsZKKA9ML65E+YI=; b=dX3aadPxf0mtrLufngP6Nm7bvtk2PYtr1KMPLbqHC/br37fSwMRzQZDUZM1sfql2T9RvJw pbO5i9nyfWOF8A3SZHiBngKeMb2kA8eLbAgMjl3WJwkQ3kuo0NrjzO3TZvR+x++jhxr/SG gnxOUtbbeBbDHVVycJkhDFDQpSKbibM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1694616048; 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=6QLGLoGaoJqwtkP43V8jHsqGgwi0QsZKKA9ML65E+YI=; b=9tVGc6sxkBE7pIho30f1Y7ryQfZgQBxvWnU2KzxRSjzDpjYoEr7RM6U5FsOju6Mkq9dE71 E8hRVMGxByQf58Dg== 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 C968813440; Wed, 13 Sep 2023 14:40:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id URtqMPDJAWWkaQAAMHmgww (envelope-from ); Wed, 13 Sep 2023 14:40:48 +0000 Message-ID: <2f2985f0-f1a7-f085-fd18-107f3fba9478@suse.cz> Date: Wed, 13 Sep 2023 16:40:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 4/6] mm: page_alloc: fix move_freepages_block() range error Content-Language: en-US To: Johannes Weiner , Andrew Morton Cc: Mel Gorman , Miaohe Lin , Kefeng Wang , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230911195023.247694-1-hannes@cmpxchg.org> <20230911195023.247694-5-hannes@cmpxchg.org> From: Vlastimil Babka In-Reply-To: <20230911195023.247694-5-hannes@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 07:40:56 -0700 (PDT) X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email On 9/11/23 21:41, Johannes Weiner wrote: > When a block is partially outside the zone of the cursor page, the > function cuts the range to the pivot page instead of the zone > start. This can leave large parts of the block behind, which > encourages incompatible page mixing down the line (ask for one type, > get another), and thus long-term fragmentation. > > This triggers reliably on the first block in the DMA zone, whose > start_pfn is 1. The block is stolen, but everything before the pivot > page (which was often hundreds of pages) is left on the old list. > > Signed-off-by: Johannes Weiner Reviewed-by: Vlastimil Babka Note below: > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index f6f658c3d394..5bbe5f3be5ad 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1652,7 +1652,7 @@ int move_freepages_block(struct zone *zone, struct page *page, > > /* Do not cross zone boundaries */ > if (!zone_spans_pfn(zone, start_pfn)) > - start_pfn = pfn; > + start_pfn = zone->zone_start_pfn; > if (!zone_spans_pfn(zone, end_pfn)) > return 0; Culdn't we also adjust end_pfn to zone_end_pfn() so we don't just ignore the last half-pageblock for no good reason? (or am I missing any?) Also would stop treating end_pfn as inclusive here and in move_freepages(), it's rather uncommon. >