Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2167752rbb; Tue, 27 Feb 2024 12:52:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVIv7uksNHwhJAjsNXBglZhdWQFVhJeXg7J9WN7TANvH40bkN3u1TeAU1iHtvBq/lxrPue9Nq+q0npyCPwLLELj7bt3DntqfO3bQtlIIg== X-Google-Smtp-Source: AGHT+IG07COFjzEikq7rdU4kHOt3wINJVRBA/luYuljoZdRAH0cXUkMpbMkceoNBNchBVi7wDdVc X-Received: by 2002:a05:6214:5245:b0:68f:88d3:c470 with SMTP id kf5-20020a056214524500b0068f88d3c470mr1053663qvb.5.1709067175573; Tue, 27 Feb 2024 12:52:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709067175; cv=pass; d=google.com; s=arc-20160816; b=pZ7jUrtR3NYPBr+m6a3YDFpsXrCs7yESY5oGvYECulWyPoMtHflqmIFgqWYDhbcIvX 9DQmRlMKZPPQp+LxrVit18Qi5DrR4N2U1pRWdEDP3xfB+7ScUpC0WyyJh+mbXkqjZEci Q4yJq4cWPL8eMbMFxvsjTDxzhBiMf2nkHvjAWAjATB+jKFaDr5TMDTgOKkg1piiaQ8xA Ed26gMl9Lo1VSSGPsYvLTviD9UAPLFmpGELGd2G/Imf/V4sws0LGpaV8Vu3tSSUPNmvP BS89X+HHh35KOgeOFKxBOUnmoVuwuM9G7XgUjeb18pqe0ghjCZATBy0SP+qVJqb/GJCi huXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pehzdoB8wsh8SgroFElaiUc6/flpbKrMg0Us2dS9mCA=; fh=dOrNcrMx5nFsXWJYpwLcpGpWEqachZHuwLK6Y9hA89k=; b=WLdUFsC2MPX2A/rpb04TXZkhd0GMU/MufQu1PsBpBOJqIVxJasxIpaS/kWrLMlPFKo reBgn4PxqmxOLzSp6saStGiHGUw4bxVvUK6qZe9+i2mpG0CP/EI/IIEWbcT6r8dyFrZp k7TvE3ODuqJs2SEBkahrnM1XOz6RBNapKyY0jriSTFrDzr+JDInll5unxCIwRNeNxWYB jVmHUGrq8KDzNojwcBW/hC3lQvD8PfiYSftZwlMrUgSCKJvvKOeFWaKEl02yeiPS+NBJ 0PYPWvNtQBXDko5xJBcIJE2l32dfxGcXM2SjOsLDeI2U/nf9ILF/uFcv4DOqrxj74zB/ FSsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="tYZW7V8/"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-83994-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83994-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a3-20020a056214062300b0068f5d435e97si8186674qvx.544.2024.02.27.12.52.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 12:52:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83994-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="tYZW7V8/"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-83994-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83994-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 54D451C244F4 for ; Tue, 27 Feb 2024 20:52:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C26615445C; Tue, 27 Feb 2024 20:51:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="tYZW7V8/" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A62214F988 for ; Tue, 27 Feb 2024 20:51:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067079; cv=none; b=pMNgGBjE3aT3hBENZ3eZZWpcuox/EeKvVrxw38RoBGh4+7p5V8z8KpaF9iFusuJ2R29UJWkjwTSHLLBlibFYHLKFcq/VbXy2JJWQEEz2BLHIgtl1aqYdAfPoJqdFGOHS5CcUrf68iA2x3xb6ZtH6baMhlroT60M28J0Fd9/jPRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709067079; c=relaxed/simple; bh=Ce4kaCaB0Xmj+UrWJOre3mHw7WLbByKBtK0VhdyFGLg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fz4XiRqD2XPJ9J2v1zGFaGDWb+x6p4uMzg6scW6WrRa2FOslVOgA4qBU2JwSH5RP3z6DpUYuVDhiQAbyKi8khJPHWfTXnDTpfpdGFGUPzGovAIiRyYJpvxsKjpKZI1x9Z0B4kdd8JWfALHcmILtoy8TlzjYvn6VzNhRy/ekFb1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=tYZW7V8/; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pehzdoB8wsh8SgroFElaiUc6/flpbKrMg0Us2dS9mCA=; b=tYZW7V8/4fYkqfd2EQxkkhF4Lb RJvdrjCOM33klyU0JVjGcHQkY6IjnYCI9vT5YaWogebG+C6j/zJZgfqdaeI1HWzuaz/4+INBxUceC Y/CeSxOVBFmcP1PaAKzJf0tpLcak8g6i8pTVuPdpnLybUXYoHrCgxMenfisPEwAm8YO9anKhLszmj 8SC8K3jp+WO35Y8SjwLbBfIcyR/zvksdcBoroN7/ODQ74lnHWiMYuw4tAV3IM9PvDOrSTHGP0aHlp HOavkUf2Zw/n4niD2AbuRJV9eqsyVPejXCBzyJcHk7hrctDVyG71anr9Vcr5uRYX+dN5aSTczy2m/ bIOXEFjQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf4Pw-00000003LmO-3QiL; Tue, 27 Feb 2024 20:51:12 +0000 Date: Tue, 27 Feb 2024 20:51:12 +0000 From: Matthew Wilcox To: Jianfeng Wang Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, sidhartha.kumar@oracle.com Subject: Re: [PATCH] mm/cma: convert cma_alloc() to return folio Message-ID: References: <20240227181338.59932-1-jianfeng.w.wang@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Feb 27, 2024 at 11:26:02AM -0800, Jianfeng Wang wrote: > > > On 2/27/24 11:00 AM, Matthew Wilcox wrote: > > On Tue, Feb 27, 2024 at 10:13:38AM -0800, Jianfeng Wang wrote: > >> Change cma_alloc() to return struct folio. This further increases the > >> usage of folios in mm/hugetlb. > > > > I love the idea, but I don't think this works. The memory returned > > from cma_alloc() isn't set up to be a folio, is it? That is, it > > doesn't have compound_head initialised so that page_folio() on > > consecutive pages will return the same pointer. > > Thanks for review. > cma_alloc() returns an array of order-0 pages. So, this commit makes > cma_alloc() return an array of folios (each an order-0 page) rather > than a compound page. Functions that use cma_alloc() do not expect > a compound page as well. No, this is not the way.