From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3359EC433FE for ; Wed, 13 Oct 2021 16:33:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B8BDE61168 for ; Wed, 13 Oct 2021 16:33:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B8BDE61168 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 39460900003; Wed, 13 Oct 2021 12:33:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 342F4900002; Wed, 13 Oct 2021 12:33:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20B37900003; Wed, 13 Oct 2021 12:33:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 11521900002 for ; Wed, 13 Oct 2021 12:33:14 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C0FD0181B048C for ; Wed, 13 Oct 2021 16:33:13 +0000 (UTC) X-FDA: 78691959066.10.95C01BE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 8E6FFB0000A6 for ; Wed, 13 Oct 2021 16:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634142792; 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=DjPbeka3uHpTPFDzZHXDiwy2JwEw+WWWUUi9suQ1zgIdtvUNFbdQjKSNTcxyRWkE3pAQyO U6mInVFJgEZID61WfH6qs9nD7LgsBYrt7rWV/xgq6d+M3KLoQLwXsYCH8V3R44i3gZG01W 3gzqL6dbZ7StdOdvkntp6UrydQ4lz14= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-Um2SrqmOP4yIxKHvyX6ybA-1; Wed, 13 Oct 2021 12:33:09 -0400 X-MC-Unique: Um2SrqmOP4yIxKHvyX6ybA-1 Received: by mail-wr1-f72.google.com with SMTP id h11-20020adfa4cb000000b00160c791a550so2446610wrb.6 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=3vpJ2WJH5ovulfkNGdERaM414sS838d6KNsWdffof11YinYxoX4RqtmK3B5bhYbh8E QWYeT74TfugJublt+85iWS7iT4rScwgZuc1mUlfH6A3j71PdCuwuY84CZQuM5QiYp4Y4 +dyA0yu7TZyrDavdk0oSV/H6g5KSBXRF5o+zxIWjFArlLyckw3RiNMX/AtjwdnuJlx2/ NxMrmzN7Pw7WEshUc5Ho6vxiDWS5eY+VYQECsQcy89hcDh0WgS+iCdTkuBsxw14P5eYL 51yLBZ/RvAXnSLUtVMruGV+bhVkD8gwG8m+3iper71G4+/jzCRs5u0mAV3lngCiLRW+b 9dnw== X-Gm-Message-State: AOAM530EeonfqWOOjq73YpCZVc6SE94PFm2Im7nawK90UMZGDXw14V3Z VZn+7TQ/7WJotMkTzlKUWd6LV5viB0qTBpRESVbF31hu07k2o0MXMDquT5MFLeJW/N2+TqRGbLa c1jwT8Lbo30s= X-Received: by 2002:a05:600c:354c:: with SMTP id i12mr268487wmq.59.1634142788096; Wed, 13 Oct 2021 09:33:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyATebHvkYdlIXZFLJ2uDSsgne/PQrLVCIJg9XLuSnik4UsKAxmcj1cRWI3KVGh8y6j1hSz/w== 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 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> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8E6FFB0000A6 X-Stat-Signature: pitwz4ukqizsog48sptho4sadimyhp3r Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DjPbeka3; spf=none (imf24.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1634142792-433450 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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