Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3625419pxb; Wed, 13 Oct 2021 09:36:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6iTBxxMzD0oYiKglSk5W+UqXmhgWE+eQGx062+Sojmcfko9GTAWRdtEy2w2a418E4A7fS X-Received: by 2002:a62:5ec2:0:b0:44d:47e2:4b3b with SMTP id s185-20020a625ec2000000b0044d47e24b3bmr403676pfb.38.1634143011807; Wed, 13 Oct 2021 09:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634143011; cv=none; d=google.com; s=arc-20160816; b=AEwsuNjEPcRy0Wq0yv6WPRcfwrEheqjtOl9BofVlXZF1IpqYU0LYTxsvpvBppCaKc6 t2GeuC+TIvNTcQ25ePu7IPZHlMWAFB+uCB0Sea5v4DPGJpPUTWbjTt/PU5AY6jSWoyU9 VNTuqWcCsMwI4HIfVX83QzzTGOH2kD4pf56MaAfxVgjCMt+saOEOVQ7+2pEn5WJV6+9H 9OcGuHG0vquRj68R/a3m6jNlX6iC1c82sYCRL/8jWXVk6wuAwnkB1kFPv1j0RK8PYMPr KQ7QW3k2nKKnL4pBWzFBxa+cRzXoTE+R7B+Lo+WoehsPEZYZ7BnSd9/WxPxuUhRL9O7p vNEQ== 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:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=TjCWmnE6MJF99gg8Np4o8A6IWCobyce/lSwyYSU7+H4=; b=rl91H8TBBdAhUkS/BJkH6YLCT3hDIgpx92k7AXF4O9SOKetWpLtS6Ei+3/ieoGuyjy AKVxiwoyru3TeWH/nAen5wSKOfqnj9TW6Wg9f0pvrmkXrDHGnw4ly6ZE2bY1Jn1KGnSc 6EQDHlW9oyIj/2pQohjEe495F5wPszRvhCqnMrdpjFOTdidCUkzf/aT2NISnB9ydrd3w sIhjpgh56M5xp3IhlwhV+E1O6TK+y3I1hQctlzUouAK2HOfc0sScuA7Cg3avK//kfNEk JBc0FaIGEEG8ahwfdkrAjj/zcIcEFGWi1GqPAt7WAmy/v9a/b41LHkpFyQFphlv3BoGk 8UKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O+FeHHOV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 12si10068496pjl.32.2021.10.13.09.36.13; Wed, 13 Oct 2021 09:36:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O+FeHHOV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237470AbhJMQfV (ORCPT + 99 others); Wed, 13 Oct 2021 12:35:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27691 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237449AbhJMQfO (ORCPT ); Wed, 13 Oct 2021 12:35:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634142790; h=from:from:reply-to:subject:subject: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=TjCWmnE6MJF99gg8Np4o8A6IWCobyce/lSwyYSU7+H4=; b=O+FeHHOVrtnS98EfIseNxhRitaHuxUUbBpdtbWgJwcYv8H32PWQkq9f6XDSKaUvZWt37fQ +HPB3Re46x4kS73xb4L2zBam/2tD90HOKYIYT4A69BB99n72Mlsc5xLVFIEnThmy4M9DLL NUewrx4JYDW4ajlBqdvjzmKFyEg7WXU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-pestMlyjO6i8ihv40pKmmQ-1; Wed, 13 Oct 2021 12:33:09 -0400 X-MC-Unique: pestMlyjO6i8ihv40pKmmQ-1 Received: by mail-wr1-f69.google.com with SMTP id f1-20020a5d64c1000000b001611832aefeso2417708wri.17 for ; Wed, 13 Oct 2021 09:33:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=TjCWmnE6MJF99gg8Np4o8A6IWCobyce/lSwyYSU7+H4=; b=CZdFdb7qOz6oMZNCGf/9xGsqDoFgcyVJN+74dzgUbeWSdGSkMskWFqVcpPxlnPte8v 0j1xaHDUmVCjn7r+4Fh+aaWuKoAJCxi8JZUKBkJaPEKIzVJY8BdA7Jd+m0bU5wheZTqM ZYZUrOUwuCZcH0mTImQhOE33Lh2Nm1uioW6BCpa7YtDQXC/+tSXjKBwB/Yu6/H2L3mW1 m/x6yWUTVq5P5NOYht7M9KNm/0jEY4PXyh+PXHOLwT5sU5K7RbtGKdmbRYfEuxDrKDce 45clXkc4TFvodXqUkS9VlHVm0qFNO31tVeZ9UQzndDFPtq8E5EbuNmMb38C5wbi9lrfT pWtw== X-Gm-Message-State: AOAM533TZBtsjM/9u9EzMuJY1Gsft+1Yb0Pt9ZztbBXOwXAY9UsN6u1+ zDvFaGhkkGZOTfRhDHs7LTg7nC6UJH5oDd4qkuodttKWvReMEZqtzJcR76DuTyJ9Iy44XV4oiPR z9/ohwDKulwk+ci5PuKV5lt/z X-Received: by 2002:a05:600c:354c:: with SMTP id i12mr268478wmq.59.1634142788084; Wed, 13 Oct 2021 09:33:08 -0700 (PDT) X-Received: by 2002:a05:600c:354c:: with SMTP id i12mr268443wmq.59.1634142787798; Wed, 13 Oct 2021 09:33:07 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6774.dip0.t-ipconnect.de. [91.12.103.116]) by smtp.gmail.com with ESMTPSA id i24sm5497209wml.26.2021.10.13.09.33.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Oct 2021 09:33:07 -0700 (PDT) Message-ID: Date: Wed, 13 Oct 2021 18:33:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Content-Language: en-US To: Kent Overstreet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, axboe@kernel.dk Cc: alexander.h.duyck@linux.intel.com References: <20211013160034.3472923-1-kent.overstreet@gmail.com> <20211013160034.3472923-2-kent.overstreet@gmail.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH 1/5] mm: Make free_area->nr_free per migratetype In-Reply-To: <20211013160034.3472923-2-kent.overstreet@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mostly LGTM. I recall that in some corner cases the migratetype stored for a pcppage does not correspond to the pagetype of the pfnblock ... I do wonder if that can trick us here in doing some accounting wrong., no that we account free pages per mirgatetype. > /* > * Set the pageblock if the isolated page is at least half of a > @@ -6038,14 +6038,16 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask) > struct free_area *area = &zone->free_area[order]; > int type; > > - nr[order] = area->nr_free; > - total += nr[order] << order; > + nr[order] = 0; > + types[order] = 0; Why the indentation change? Looks unrelated to me. > > - types[order] = 0; > for (type = 0; type < MIGRATE_TYPES; type++) { > if (!free_area_empty(area, type)) > types[order] |= 1 << type; > + nr[order] += area->nr_free[type]; > } > + > + total += nr[order] << order; > } > spin_unlock_irqrestore(&zone->lock, flags); > for (order = 0; order < MAX_ORDER; order++) { > @@ -6623,7 +6625,7 @@ static void __meminit zone_init_free_lists(struct zone *zone) > unsigned int order, t; > for_each_migratetype_order(order, t) { > INIT_LIST_HEAD(&zone->free_area[order].free_list[t]); > - zone->free_area[order].nr_free = 0; > + zone->free_area[order].nr_free[t] = 0; > } > } > > @@ -9317,6 +9319,7 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > struct page *page; > struct zone *zone; > unsigned int order; > + unsigned int migratetype; > unsigned long flags; > > offline_mem_sections(pfn, end_pfn); > @@ -9346,7 +9349,8 @@ void __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > BUG_ON(page_count(page)); > BUG_ON(!PageBuddy(page)); > order = buddy_order(page); > - del_page_from_free_list(page, zone, order); > + migratetype = get_pfnblock_migratetype(page, pfn); As the free pages are isolated, theoretically this should be MIGRATE_ISOLATE. > + del_page_from_free_list(page, zone, order, migratetype); > pfn += (1 << order); > } > spin_unlock_irqrestore(&zone->lock, flags); > @@ -9428,7 +9432,7 @@ bool take_page_off_buddy(struct page *page) > int migratetype = get_pfnblock_migratetype(page_head, > pfn_head); > > - del_page_from_free_list(page_head, zone, page_order); > + del_page_from_free_list(page_head, zone, page_order, migratetype); > break_down_buddy_pages(zone, page_head, page, 0, > page_order, migratetype); > if (!is_migrate_isolate(migratetype)) > diff --git a/mm/page_reporting.c b/mm/page_reporting.c > index 382958eef8..4e45ae95db 100644 > --- a/mm/page_reporting.c > +++ b/mm/page_reporting.c > @@ -145,7 +145,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, > * The division here should be cheap since PAGE_REPORTING_CAPACITY > * should always be a power of 2. > */ > - budget = DIV_ROUND_UP(area->nr_free, PAGE_REPORTING_CAPACITY * 16); > + budget = DIV_ROUND_UP(area->nr_free[mt], PAGE_REPORTING_CAPACITY * 16); > I think we might want the total free pages here. If we want to change the behavior, we should do it in a separate patch. -- Thanks, David / dhildenb