Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2834723lqp; Mon, 25 Mar 2024 10:28:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6aexXKpYxQ8oZRjaecqnUjR8hY8qAQThceZKcr76xqdNxv0u5O9rHlH1kituGw/AvZ5+n32wy4TeuJm2sHuEIYyenD6jWrXPSEGftBw== X-Google-Smtp-Source: AGHT+IHuoQ188UNN+WcUOqYv5DY8pAr2BN8W4KZg3b9g2lNJnjWPQZeDG7v1dG+vE2vG7mxdQp38 X-Received: by 2002:a05:620a:244b:b0:78a:2900:418e with SMTP id h11-20020a05620a244b00b0078a2900418emr10270670qkn.60.1711387731267; Mon, 25 Mar 2024 10:28:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711387731; cv=pass; d=google.com; s=arc-20160816; b=sgktxEI6Feq5spxid9boLBUcF7Sp8Oe3ExLMO1dO8S4TActRVkhN4FTbWeJX33BssX ynzWz1kitUH05mxWPW3EC26alrxKWbz8acNmHfknWVzizZIctOY7AFviT1P/lQWlKtMv 9K4LGrb3PlzdQI5vgZ80Y/Uf1a2XzC7gjmnz0xw8DtEC0RPotysdCU7YZxzU2aNRrUWS lLUerjU7nB/k5Pcs/xfyNkhtRe0ASLVwMMSgZpF5B9esXJ2Jz2gm2YxHjG4FZ8kNn/F3 vqFzuNv0hLIj17tlPXAKKGipcdGHMSMrKvglRpMh8z2SC71qFIkJxe0ByxkHnaXQlTld hdLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=8pMQ/oo81Y3FaZHkSy9sDeQffPP6Xckn73dbgRd3Hhg=; fh=9vOKXHL6fO/AF8FXvDu9yXhNS2K6dIUKa5pMm3jPSHM=; b=KrMuRuXHY0h4njU6CQ7dQlexnrVktbk2RnIpXWjCpH6yu9P2PmpW4ME9r3AGMGgC49 Rw7YMUBuy37BPmIPw9YPBPDCDkYsFj+71LUXKEyuu4GQK7zENkrz4X+o87NkiOcDCc57 72Z1l1zOFcxDNFFzSUpaQKNWDAQwRuJt909VwJV39bcUqz+3ttphYIq/dh0ACPw4AvhN 6sJ2kyuW5LyDwn9oKJ5oWvPnO7V1PU9avCdz9/8iyG32pYXDV6EFgsJR3gNGbwNXgMi3 p/4RQTGRgNsRD3VQiH0i8ujiZCA2K0dpqld8PJjarL+T85MhoyFf9LQos73GvsPerVMo yaVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="OitADZr/"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="OitADZr/"; dkim=neutral (no key) header.i=@suse.cz; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-117459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117459-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id wl16-20020a05620a57d000b0078a40dc62c7si5916033qkn.43.2024.03.25.10.28.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:28:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="OitADZr/"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="OitADZr/"; dkim=neutral (no key) header.i=@suse.cz; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-117459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117459-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E77751C24D16 for ; Mon, 25 Mar 2024 17:28:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF6CE12DD87; Mon, 25 Mar 2024 16:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="OitADZr/"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="eCcozfZF"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="OitADZr/"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="eCcozfZF" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C0569474 for ; Mon, 25 Mar 2024 16:22:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711383733; cv=none; b=LE6FCxHQs+G8iyjrQ8HNMRSEJKkzOFRdqcd1kwzkjHivxJH11cW7cbqE4g8DN7vzyII01Drth4TRtbjo3gigWJgo2t2AtFBCMhvwBDBj4tU2JU3Y7eODP1rIKmlSpO5rTFIi0Fj9div011pt8znINOEeXXm3woC8AsAa/t/3MDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711383733; c=relaxed/simple; bh=34Fay1VYIuAdJvEofq/9qAHIIbMDTvr7zOVPImL2NVA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jvwCayY9z6HrFMayBLyDL4FfWP9sKKqhexUAwJevQgu6LlfuKKEgDAMcj5mftJ7qZKg0YIwMRrvXkculBZHue+KFFYlhvgsvMvFPGrExwIg+LBJT56Ou6N4RITGI5Y5Qq9BIpvlilSWumzzPABUvkLLWd4fMW6iyvPdsjYWoPlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=OitADZr/; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=eCcozfZF; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=OitADZr/; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=eCcozfZF; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 67C1F5C8FC; Mon, 25 Mar 2024 16:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1711383729; 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=8pMQ/oo81Y3FaZHkSy9sDeQffPP6Xckn73dbgRd3Hhg=; b=OitADZr/dd+M3VXCCcIh1qtmFJkg0ojHQK8Vey6CMHdl15slRMfkP3XM7yMfQfw+iGNRE0 YDVTxkkkkwLvYDEtivoWK0rVH+he8BTTH3yx0ifxr7eRJqeSfiqgG8MvpbeSCvgYFU6tKM 7sg+7LI4QIP5B5ikL6fe8MHRI/gA/ew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1711383729; 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=8pMQ/oo81Y3FaZHkSy9sDeQffPP6Xckn73dbgRd3Hhg=; b=eCcozfZFcSUsbvTGonPLFjaOWfJfg9TNNuUBK9UUtVWDsDURNR64FI9Jzolc6FgbHTTKDa fkmjO6bYLtMrcMBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1711383729; 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=8pMQ/oo81Y3FaZHkSy9sDeQffPP6Xckn73dbgRd3Hhg=; b=OitADZr/dd+M3VXCCcIh1qtmFJkg0ojHQK8Vey6CMHdl15slRMfkP3XM7yMfQfw+iGNRE0 YDVTxkkkkwLvYDEtivoWK0rVH+he8BTTH3yx0ifxr7eRJqeSfiqgG8MvpbeSCvgYFU6tKM 7sg+7LI4QIP5B5ikL6fe8MHRI/gA/ew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1711383729; 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=8pMQ/oo81Y3FaZHkSy9sDeQffPP6Xckn73dbgRd3Hhg=; b=eCcozfZFcSUsbvTGonPLFjaOWfJfg9TNNuUBK9UUtVWDsDURNR64FI9Jzolc6FgbHTTKDa fkmjO6bYLtMrcMBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 51F6E13503; Mon, 25 Mar 2024 16:22:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mm2XE7GkAWaRFgAAD6G6ig (envelope-from ); Mon, 25 Mar 2024 16:22:09 +0000 Message-ID: <47ba1e37-6431-44c7-b809-61c7bd832893@suse.cz> Date: Mon, 25 Mar 2024 17:22:09 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/10] mm: page_alloc: fix move_freepages_block() range error Content-Language: en-US To: Johannes Weiner , Andrew Morton Cc: Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240320180429.678181-6-hannes@cmpxchg.org> From: Vlastimil Babka In-Reply-To: <20240320180429.678181-6-hannes@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -2.63 X-Spamd-Result: default: False [-2.63 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-1.34)[90.42%]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Flag: NO On 3/20/24 7:02 PM, 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 > --- > mm/page_alloc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index a1376a6fe7e4..7373329763e6 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1645,9 +1645,15 @@ int move_freepages_block(struct zone *zone, struct page *page, > start_pfn = pageblock_start_pfn(pfn); > end_pfn = pageblock_end_pfn(pfn) - 1; > > - /* Do not cross zone boundaries */ > + /* > + * The caller only has the lock for @zone, don't touch ranges > + * that straddle into other zones. While we could move part of > + * the range that's inside the zone, this call is usually > + * accompanied by other operations such as migratetype updates > + * which also should be locked. > + */ > if (!zone_spans_pfn(zone, start_pfn)) > - start_pfn = pfn; > + return 0; > if (!zone_spans_pfn(zone, end_pfn)) > return 0; >