Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp246729rwe; Fri, 14 Apr 2023 02:02:38 -0700 (PDT) X-Google-Smtp-Source: AKy350bfrz6mAP7u90ra1kXuvyJl93tdXzqRxwZqv8IYWKzfEL2cMDwliS6iFowCxbOZS07dwhAE X-Received: by 2002:a05:6a20:78a1:b0:eb:6e43:8e1b with SMTP id d33-20020a056a2078a100b000eb6e438e1bmr4653423pzg.30.1681462958287; Fri, 14 Apr 2023 02:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681462958; cv=none; d=google.com; s=arc-20160816; b=qB8C1oavQbGnZQM1/IM1lOyyFUzAECGbx/trZb0kRKEdrLYcCYmLS3ktGGvW9wfoDH sTAb4UBycLTfaWFrUUAD0Af1VzqUSjBjMvc/4GNHL1N9D9Xz4zWOhckxR+jDo6rmMYQg HWq9FlQ9ykkDoNUeJJJTghou10fIP5cuPbZsvdNYt9rg54BqeWe/xueBSxLAl74uMsJf KhCtPpRzVFhBymnZBJjUqCjrUvCAn/TCluSZJ+G8JOtow1IJtWPXYOt//xltYKEO1SMB WNNIla+Z0T8leuK8WGXAtgPCzcN7o4uW1z7pzpx6fdMxOruKxj+ron6H6QvVaLyQVUwM HVpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+b1nXR1/twCQQQ/roM9DsodBpfN4oiR4RlY92NuwKQQ=; b=lKFVGU6LvXsyGAEmgzGqvMl6pNn8Pwi4wBMzEZSy4/VMiSlhHrU3xBGGW/mzbIeWGa 1jPguEqPTFaqPN34M7N+NTKT3MrQdI/cFuz92luds3zaQrAV+2kFoIJ1/GZAGIdpLFm4 z7dzmJYSCYDRAhXrC11j3gqLb66eScMzVmJ1/DINrnKuX4qEnBeeNGwYc18KENzQPTmh /WtJX2F2QufNpPChRL+81BhZ3oz0TV7+RCNDvtz2ZYhDt3FKmgN9bh/Xhqq1bP9Hqh+x 6mpNCeyXN3KXOhV+S5dUfbNvKaJWO3BUJvoOmqouE2+G9gsWwUHy9LqYWLgMOH/MGUvD lcrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fDrjVW3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u184-20020a6385c1000000b00519b091d084si4516954pgd.19.2023.04.14.02.02.21; Fri, 14 Apr 2023 02:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fDrjVW3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbjDNIzJ (ORCPT + 99 others); Fri, 14 Apr 2023 04:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjDNIzH (ORCPT ); Fri, 14 Apr 2023 04:55:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C2E5B98 for ; Fri, 14 Apr 2023 01:55:06 -0700 (PDT) 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-out2.suse.de (Postfix) with ESMTPS id A0F521FD96; Fri, 14 Apr 2023 08:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681462505; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+b1nXR1/twCQQQ/roM9DsodBpfN4oiR4RlY92NuwKQQ=; b=fDrjVW3Fui9s9OCo1q3Z+4UE/rSwhTrGKrI/XGr8Mvl5ceC3tLTvGu/UYWOBvDVpRitixz RAvLnlQ1mrDgcCzHQcLuKEek+iPjvHn3YkXzrlL7zM67RBcHXIP8+jojJ3g2Ti3595Pp72 tEchRF7u4bCA29jpNRLNTEd181bobJo= 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 6C57813498; Fri, 14 Apr 2023 08:55:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 42f5EOkUOWQteAAAMHmgww (envelope-from ); Fri, 14 Apr 2023 08:55:05 +0000 Date: Fri, 14 Apr 2023 10:55:04 +0200 From: Michal Hocko To: Mel Gorman Cc: Andrew Morton , Vlastimil Babka , Oscar Salvador , Yuanxi Liu , David Hildenbrand , Linux-MM , LKML Subject: Re: [PATCH] mm: page_alloc: Assume huge tail pages are valid when allocating contiguous pages Message-ID: References: <20230414082222.idgw745cgcduzy37@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414082222.idgw745cgcduzy37@techsingularity.net> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 14-04-23 09:22:22, Mel Gorman wrote: [...] > + > + /* > + * Do not migrate huge pages that span the size of the region > + * being allocated contiguous. e.g. Do not migrate a 1G page > + * for a 1G allocation request. CMA is an exception as the > + * region may be reserved for hardware that requires physical > + * memory without a MMU or scatter/gather capability. > + * > + * Note that the compound check is race-prone versus > + * free/split/collapse but it should be safe and result in > + * a premature skip or a useless migration attempt. > + */ > + if (PageHuge(page) && compound_nr(page) >= nr_pages && > + !is_migrate_cma_page(page)) { > + return false; Is the CMA check working as expected? The function sounds quite generic and I agree that it would make sense if it was generic but it is used only for GB pages in fact and unless I am missing something it would allow to migrate CMA pages and potentially allocate over that region without any possibility to migrate GB page out so the CMA region would be essentially unusable for CMA users. GB pages already have their CMA allocator path before we get to alloc_contig_pages. Or do I miss something? -- Michal Hocko SUSE Labs