Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3958498rdb; Thu, 14 Sep 2023 07:50:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIkxNHOPiAv3WM+HQNZpOqpVXNSGlAv2ZXPnb78WKov6iRAjjqHduF/uku8GHKRiGiJCvI X-Received: by 2002:a17:90b:1003:b0:26f:4685:5b69 with SMTP id gm3-20020a17090b100300b0026f46855b69mr5249262pjb.7.1694703008932; Thu, 14 Sep 2023 07:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694703008; cv=none; d=google.com; s=arc-20160816; b=Up+HPUMd/jRtKkqT7bVokd6YkfvOJrzbeK/vcev1v6TGpiGNin7JjdiiGZb+npZ/H3 s3Db30lM4rT6qCD0MXjZCd8QdI9Gmaoh3L0XNhULFz++uA82YFf/SVPJ6jt+/+8nLTHp aAZFH4RuFDE2dh9bzfh84feAsSt+Mggek0s1HTGvk8TVr/n7J+mb+G7cE7BgwgfsP+FP QOVVHpgfBFeelACfXg/23cBYekRx+h5+WlUKzp9FdP8dbpuV+0xEE23KY6wRg5n/FHqR EV1p+easSymfvjCdm+c9buQL0YjNPwQ1YcgZXEEdyPDRMj4Pk6XIIFD4TZwgWkkP89qO ZZoQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9UjaH6awq5V/b/h5EjTWTj3DotldQx6AS4c6JYOsrlY=; fh=+KmY7Fu4Rqd+UuMxTa02SLBPUTWXvWKXT0NdYeUuruI=; b=xfc2xElTt/tlxhBPJEDBJzgn1foJvtIGgitRzsdSgmqTXi1K3ImFo4SZOgI5TaTWt8 5NwxLxBMc74yeyGkX82ktmCccDIn5NPTjvvYSmqn+wUBZ3g/l6UnZgFYZGX3XdYmmwkR 2TyUoKJXEJqUpazS0fbKKMFucgbdDv34mNUlPBq5CaceqABJakejEr5Ces9VnQfPhWIV 08QEoCYDpqH9a7OoySSJAMNo0EtnXSTICuLmWy/Sp/wfj03DCN5yaexVIDhizA0K3XbG bBoXaABz0bI+YwdXC6GqxPEmiFTHk/FvEFQKXehpFEe91pGQzGJ9MZ9ouLvq/Q7pB/7x B42A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="f/Z4cmnj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id i10-20020a17090adc0a00b00273f1cd73b2si1747822pjv.75.2023.09.14.07.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:50:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="f/Z4cmnj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 825F980BC3F1; Thu, 14 Sep 2023 06:40:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239760AbjINNkG (ORCPT + 99 others); Thu, 14 Sep 2023 09:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239637AbjINNjz (ORCPT ); Thu, 14 Sep 2023 09:39:55 -0400 Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E044498 for ; Thu, 14 Sep 2023 06:37:50 -0700 (PDT) Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-450711d9bf1so542519137.1 for ; Thu, 14 Sep 2023 06:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1694698669; x=1695303469; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9UjaH6awq5V/b/h5EjTWTj3DotldQx6AS4c6JYOsrlY=; b=f/Z4cmnj6enPrTWIXfYtVYxLN/CuOVi/hJmahdCSxfkLgWuObcXL2lVi4MU73/mlxd JtkjE11DJvw9BW/m9VEeL8yRwgEqIP4j2g7Z+bW6S3L5WzmFbOshHOZhzB8m/YoZimzM oofKzUIl+ifzdSdc4fv2h6hjTp/pYYqipmqIiojKtUMUO0RYmvNvQV2nTkNg3BXXjUDl MPhiML5iW6jnXawv6lPfdMs1Ega7J4XL2l2MId32YMHy8WalCepieaEDO6bw7/vyn/DP Df2zcegRn/c3QmxJ/0qX66hMDNwscsdkM3unsQgxl22AQsRnqgXGrsEQZtlXEGJvzIoH LBlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694698669; x=1695303469; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9UjaH6awq5V/b/h5EjTWTj3DotldQx6AS4c6JYOsrlY=; b=ITgHVHlPADfFy8HSFkXBTSRm2auM4j71zso930FY11zSIeilsZLze479ksMdK8KKdr gsGRp6YBET4Yw0Ep7oyfDIt+YpEljOraMjDIWxFCVcs7QqzSJDnM/tHCXrD2ufkUZCA9 H6yvZjXy4E04mmmDM7OikijaMm65rq/RXXKTOsHIql0f7BJj8G0wZzRMBdFaZw2+zinL OCmJwdoTfR5njsqde9Hx/gT+GjgxJ+aqeB5m/oLpw4ymNBBkBttVRC/QypLK778HIrdQ siQP1oDoTLKrbOxJfYVhiArl/9+jiN+nBzdLoI2GjZrbUggFN5Bv7ngQcrWwP71lFhy8 SiWw== X-Gm-Message-State: AOJu0YyB7ltds+FpNUHio0vMQdxrn1vYVQDZtMbAqDTX5WCfzeMGALsG 1V40FCfgcecohbd/hl9AhhUFNQ== X-Received: by 2002:a67:f84d:0:b0:44d:634c:1125 with SMTP id b13-20020a67f84d000000b0044d634c1125mr5277278vsp.13.1694698669249; Thu, 14 Sep 2023 06:37:49 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:35bb]) by smtp.gmail.com with ESMTPSA id h16-20020a0cf410000000b0064713c8fab7sm476813qvl.59.2023.09.14.06.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 06:37:48 -0700 (PDT) Date: Thu, 14 Sep 2023 09:37:48 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Miaohe Lin , Kefeng Wang , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] mm: page_alloc: fix move_freepages_block() range error Message-ID: <20230914133748.GE48476@cmpxchg.org> References: <20230911195023.247694-1-hannes@cmpxchg.org> <20230911195023.247694-5-hannes@cmpxchg.org> <2f2985f0-f1a7-f085-fd18-107f3fba9478@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f2985f0-f1a7-f085-fd18-107f3fba9478@suse.cz> 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 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:40:17 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 pete.vger.email On Wed, Sep 13, 2023 at 04:40:48PM +0200, Vlastimil Babka wrote: > 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 Thanks! > > @@ -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. You raise a good point here and in the reply to 5/6. Let me reply to the other email.