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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462FEC433F5 for ; Tue, 30 Nov 2021 10:09:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B24D76B0073; Tue, 30 Nov 2021 05:09:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD4C96B0074; Tue, 30 Nov 2021 05:09:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99D176B0075; Tue, 30 Nov 2021 05:09:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 8B7276B0073 for ; Tue, 30 Nov 2021 05:09:08 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 41B808DF97 for ; Tue, 30 Nov 2021 10:08:58 +0000 (UTC) X-FDA: 78865173114.02.414D839 Received: from outbound-smtp53.blacknight.com (outbound-smtp53.blacknight.com [46.22.136.237]) by imf19.hostedemail.com (Postfix) with ESMTP id 7E1CAB0000AD for ; Tue, 30 Nov 2021 10:08:52 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp53.blacknight.com (Postfix) with ESMTPS id 9A651FAF3D for ; Tue, 30 Nov 2021 10:08:55 +0000 (GMT) Received: (qmail 25169 invoked from network); 30 Nov 2021 10:08:55 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 30 Nov 2021 10:08:55 -0000 Date: Tue, 30 Nov 2021 10:08:53 +0000 From: Mel Gorman To: Vlastimil Babka Cc: Zi Yan , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michael Ellerman , Christoph Hellwig , Marek Szyprowski , Robin Murphy , linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, iommu@lists.linux-foundation.org Subject: Re: [RFC PATCH 0/3] Use pageblock_order for cma and alloc_contig_range alignment. Message-ID: <20211130100853.GP3366@techsingularity.net> References: <20211115193725.737539-1-zi.yan@sent.com> <3083463d-978b-fbe6-dadf-670d400ed437@suse.cz> <52dbf824-76be-cc34-3983-d45510b1b618@suse.cz> <35A20739-152A-450E-8535-2236D2B28748@nvidia.com> <1c67bb96-24db-f5a6-7520-3d97e54e5192@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1c67bb96-24db-f5a6-7520-3d97e54e5192@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7E1CAB0000AD X-Stat-Signature: ouzgc6udx6zbny1snxzrfsowkrdoj4an Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.237 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-HE-Tag: 1638266932-770199 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: On Tue, Nov 30, 2021 at 10:11:36AM +0100, Vlastimil Babka wrote: > >>> I find that two pageblocks with different migratetypes, like MIGRATE_RECLAIMABLE > >>> and MIGRATE_MOVABLE can be merged into a single free page after I checked > >>> __free_one_page() in detail and printed pageblock information during buddy page > >>> merging. > >> > >> Yes, that can happen. > >> > >> I am not sure what consequence it will cause. Do you have any idea? > >> > >> For MIGRATE_RECLAIMABLE or MIGRATE_MOVABLE or even MIGRATE_UNMOVABLE it's > >> absolutely fine. As long as these pageblocks are fully free (and they are if > >> it's a single free page spanning 2 pageblocks), they can be of any of these > >> type, as they can be reused as needed without causing fragmentation. > >> > >> But in case of MIGRATE_CMA and MIGRATE_ISOLATE, uncontrolled merging would > >> break the specifics of those types. That's why the code is careful for > >> MIGRATE_ISOLATE, and MIGRATE_CMA was until now done in MAX_ORDER granularity. > > > > Thanks for the explanation. Basically migratetypes that can fall back to each > > other can be merged into a single free page, right? > > Yes. > > > How about MIGRATE_HIGHATOMIC? It should not be merged with other migratetypes > > from my understanding. > > Hmm it shouldn't minimally because it has an accounting that would become > broken. So it should prevent merging or make sure the reservations are with > MAX_ORDER granularity, but seems that neither is true? CCing Mel. > MIGRATE_HIGHATOMIC pageblocks can have pages allocated of different types, particularly UNMOVABLE and potentially RECLAIMABLE. The reserving or releasing MIGRATE_HIGHATOMIC pageblocks should be done with reserve_highatomic_pageblock and unreserve_highatomic_pageblock to get the accounting right. However, there does not appear to be any special protection against a page in a highatomic pageblock getting merged with a buddy of another pageblock type. The pageblock would still have the right setting but on allocation, the pages could split to the wrong free list and be lost until the pages belonging to MIGRATE_HIGHATOMIC were freed again. Not sure how much of a problem that is in practice, it's been a while since I've heard of high-order atomic allocation failures. -- Mel Gorman SUSE Labs