Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2756075pxb; Mon, 18 Oct 2021 00:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2+shgXx9b1uv6NWPb9kYtp2ON2Ehy4alCMQ8+4Mf+k4LwI5fCjOOSC2kV/fcodxcWQ1Ys X-Received: by 2002:a17:90a:ba88:: with SMTP id t8mr45506010pjr.15.1634543271015; Mon, 18 Oct 2021 00:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634543271; cv=none; d=google.com; s=arc-20160816; b=vT86nymLrKL2jHKSNLBqoUNWmOQUKnESWnJof9LtW3euL0y1lS4uA4wrNQvxYVH++v Z3iTS7biuF3P0PzZH68qLMFFLsvCjjeCC14X2EI/GuXAaKCXysXclsM80IYPvCciEV/V E63fNj3qfTiY8YfGNJzqPP09ANj8IwdOQRP4VrW70sXLLQjzOSA2Ha7zfgrKslu8Pp1N dGZKEme32AwlqerO9Jb0RpV3WCN7vTGQJ+FcsZV9fcknAmIT4OZTDOMutJqR9JLCBBW6 HXKh6aLwl7UI9BoqFaCEffAnuVe+UF/o0h0j646QSBmOOI44bRlimk0MfQR0vg8am2Vs 3teQ== 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 :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=uRitaSdTVQaJHWkcEYYfsZh1e5H5O4Y2u6C6EN9RHZw=; b=KjLLdInLg9aTZ1F4vHlYQQUXG/ryBaCjcGdZtd6CRmht+e8fkJRKD23VERNRj+BuGb BRFWwMTtEm/uPKD1nAFPbzHxOlJbEtDvlsz5atYlGN3aQ/c/eTxON/IKACeQzkXAjpxx KuwnOZhCO+pmRWWfpFAzMBUGwC4YkB/3sWFuWjiS0RToHBHUf/st1UFEFWSmohky2tL6 JuegY0c8RczqoiGLdQ6pWPvve4fCgtGQ9o2vQ11CAFOpDseHNUwpSySczhBnxOGHx6S6 ADclo+xvNujGRplQfTP+FQCTjWeXvjGgpPEo2eIOiDUjwNEDKCyg7kvQUOz8W8/1rvLf u8uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=gUoGOZZo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si21213135pgv.307.2021.10.18.00.47.37; Mon, 18 Oct 2021 00:47: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=@suse.cz header.s=susede2_rsa header.b=gUoGOZZo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbhJRHqy (ORCPT + 99 others); Mon, 18 Oct 2021 03:46:54 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:33280 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbhJRHqx (ORCPT ); Mon, 18 Oct 2021 03:46:53 -0400 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-out1.suse.de (Postfix) with ESMTPS id 7A87721A6B; Mon, 18 Oct 2021 07:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634543081; 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=uRitaSdTVQaJHWkcEYYfsZh1e5H5O4Y2u6C6EN9RHZw=; b=gUoGOZZobYJpoYjwU2IYPymMA2YuQ+2qgz7MpnioolDyxfQi34gjYGErciu7THulCvDIqH E7qmjTjvluoTqPaG4qvEl19HG8kMSL6uyXSBA/+xPDdly7aws8Gi9L8GNw+9p5mYyMAd4V djR7gC7CKd0VOHwEq/c5fpRQ7D+qZ2o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634543081; 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=uRitaSdTVQaJHWkcEYYfsZh1e5H5O4Y2u6C6EN9RHZw=; b=fIfevUhOPCPCtiqRALZ1/X9QKxZrhIYuKH49E96y7E0LnvrY8Z1tbgxJtHXE3fpRTpSYki Fq56TopyYm6xSyBA== 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 504DD13CC9; Mon, 18 Oct 2021 07:44:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wgNzEuklbWFDFgAAMHmgww (envelope-from ); Mon, 18 Oct 2021 07:44:41 +0000 Message-ID: <11b2fa69-ebcf-fec4-73e5-51ada24c5aaf@suse.cz> Date: Mon, 18 Oct 2021 09:44:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Content-Language: en-US To: Kent Overstreet , David Hildenbrand Cc: 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, alexander.h.duyck@linux.intel.com, David Rientjes References: <20211013160034.3472923-1-kent.overstreet@gmail.com> <20211013160034.3472923-2-kent.overstreet@gmail.com> From: Vlastimil Babka Subject: Re: [PATCH 1/5] mm: Make free_area->nr_free per migratetype In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/14/21 16:45, Kent Overstreet wrote: > On Wed, Oct 13, 2021 at 06:33:06PM +0200, David Hildenbrand wrote: >> > @@ -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. > > Thanks for noticing that - I somehow missed the fact that pageblock migratetypes > change at runtime, Not only that. Buddy merging will also merge pages from different migratetypes. I think that's the main reason why nr_free is not per migratetype. Your patch has been attempted few times already, e.g. here [1]. [1] https://lore.kernel.org/all/alpine.DEB.2.10.1611161731350.17379@chino.kir.corp.google.com/ > so my patch is wrong. I'm going to have to rework my patch to > store the migratetype of free pages in the page itself. Yeah that would be the solution. Will likely bring some overhead to alloc/free fastpaths, which would have to be worth it, so nobody attempted it.