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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E5EC433EF for ; Tue, 23 Nov 2021 17:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239237AbhKWRfs (ORCPT ); Tue, 23 Nov 2021 12:35:48 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:47744 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbhKWRfq (ORCPT ); Tue, 23 Nov 2021 12:35:46 -0500 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 D89BE212BC; Tue, 23 Nov 2021 17:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637688757; 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=6JdPmib3v3gvcHABOETzZ3g4yrxlrjaBoIvxgUisgUk=; b=r66JtRer23NJRk+k29auveGw9fDYYnj0ZMA02hzpnaNq9sbA2d2i9wNaNeUo+j2IJ+Q+S3 uZerhJbz8BNYQq0PXN0sjeLAHJ/BQxGW+GlZPuTTa6dU/wQemLh4eMQlVi3PXr5f4INu5y KMzb0hwlvKwk2q6GiaAjfIfmzPpQnng= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637688757; 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=6JdPmib3v3gvcHABOETzZ3g4yrxlrjaBoIvxgUisgUk=; b=am4OCcexfMnSxTwGto3ZBFdx8gLwbJTA6JYc4MlBNIz2Levx3vwYlKj26iSJoKTHit3rsa GhHA2+pzc6oSP7Aw== 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 A564313E41; Tue, 23 Nov 2021 17:32:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZCVIJ7UlnWGZfgAAMHmgww (envelope-from ); Tue, 23 Nov 2021 17:32:37 +0000 Message-ID: <52dbf824-76be-cc34-3983-d45510b1b618@suse.cz> Date: Tue, 23 Nov 2021 18:32:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: en-US To: Zi Yan Cc: 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 References: <20211115193725.737539-1-zi.yan@sent.com> <3083463d-978b-fbe6-dadf-670d400ed437@suse.cz> From: Vlastimil Babka Subject: Re: [RFC PATCH 0/3] Use pageblock_order for cma and alloc_contig_range alignment. 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 11/23/21 17:35, Zi Yan wrote: > On 19 Nov 2021, at 10:15, Zi Yan wrote: >>>> From what my understanding, cma required alignment of >>>> max(MAX_ORDER - 1, pageblock_order), because when MIGRATE_CMA was introduced, >>>> __free_one_page() does not prevent merging two different pageblocks, when >>>> MAX_ORDER - 1 > pageblock_order. But current __free_one_page() implementation >>>> does prevent that. >>> >>> But it does prevent that only for isolated pageblock, not CMA, and yout >>> patchset doesn't seem to expand that to CMA? Or am I missing something. >> >> Yeah, you are right. Originally, I thought preventing merging isolated pageblock >> with other types of pageblocks is sufficient, since MIGRATE_CMA is always >> converted from MIGRATE_ISOLATE. But that is not true. I will rework the code. >> Thanks for pointing this out. >> > > 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.