Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1383869pxy; Sun, 15 Aug 2021 19:39:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdDgdgZKuo2Js0jUqQiivgnolHDpBuPP3Qh9n5OH9Ch9V4LSnuRop36RlpadLACGTVuCF3 X-Received: by 2002:a17:906:4cc1:: with SMTP id q1mr5029157ejt.415.1629081544396; Sun, 15 Aug 2021 19:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629081544; cv=none; d=google.com; s=arc-20160816; b=QfeewutiHQVi78ZdWQX9sqvyQzTfjjvYvpL7iwycbbeO9OfPXxq66WqHUevkckvT2C P4CY8/4/8XYONxMU2lChHX6VaFrYWvGWHHBCD5FGrGc1DrwCwdQf3Sw78+EbsiKqf5zp ToAzSVyyd6XF3H20UOHMLd4QwF0iuVseg9qoAu+nbF0pRWKRF8RRH++YeFPWFwa6Fzr+ tFsq+kEWfn43J2f2QQ51qj4cQod3JIPr1VPH9PUtkb+SomroykAlbkhLwEwA7Q2ZsNHe zmg7bBTwS5VQDMzH0BHBV6t9WRTrZAxalPWI6lKE03oF9+TAwFh4wDi97p9Ck7ou+OeT al5A== 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=vMl2VNdGk09tKhD3GllFTX36GUewTvfnz70jPsRuisE=; b=xt/7tIKaNKxnMB+1T++RLgc+D+VszyzdRroQpTQF5MtB4qMzCT2tYDyON169ZVlaLL zFUsPCKQ1XwIe2+mSWvIK5MsBRsmnzQPzfgApzowIcnYX9eqYCtpxl2o8UFGot6aqeIW 1+jKhm6EHBPb2yoXouJh/uMUNpMqh+ljbRc14CZ/XT/t8RtblWjjsysKYImqZgJFgnsK 0GWEXRZ8sTVLevDwUc45qWZca7GcBYsZcw0Mhho702ODunqQ9lMy+EX/LzQV8/9gyRLL gW5Ym6o/+BqnoeY309EOCd9S3WDMtTNqcgE90erlnGyxCrjMpPYpa4V0gyL34QW9dFtZ Ve/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=I3HcwZSz; 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 l15si8647346ejq.576.2021.08.15.19.38.41; Sun, 15 Aug 2021 19:39:04 -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=@infradead.org header.s=casper.20170209 header.b=I3HcwZSz; 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 S231564AbhHPCgM (ORCPT + 99 others); Sun, 15 Aug 2021 22:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbhHPCgL (ORCPT ); Sun, 15 Aug 2021 22:36:11 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B524EC061764; Sun, 15 Aug 2021 19:35:40 -0700 (PDT) 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=vMl2VNdGk09tKhD3GllFTX36GUewTvfnz70jPsRuisE=; b=I3HcwZSzqquYk2qrb9TMsXbbdU OFiZRP8wFNRyufteckPxWtUxpKV1lJeMBslJpcH1rVMm6iV61ZJ7PjM/Fjylv67sH3QLhnLTgIVwA hhGdH08VdNX20AFLVNGNjTVN22axpgchV23w17JTqVdUD4QtYs+acCcY3SUlb5zRhw7ijpKwboajS KdPL7lDSSchtlK3+6lgG/9dfDpgKabc5CPbVcSfsKSvR4JggPgobfdgZUS2noRgb9tqn1mVy1rRHX ba9T8YGprwqE8WRX0sY+72or6f3XnESvJhl5QM4yVFhsXVkMZNkh2omwaOBbc//tlkDHGljqrnowE B4hTnZsw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFST8-000sTw-Bg; Mon, 16 Aug 2021 02:35:28 +0000 Date: Mon, 16 Aug 2021 03:35:18 +0100 From: Matthew Wilcox To: David Howells Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v14 084/138] mm/page_alloc: Add folio allocation functions Message-ID: References: <20210715033704.692967-85-willy@infradead.org> <20210715033704.692967-1-willy@infradead.org> <1814546.1628632283@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1814546.1628632283@warthog.procyon.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 10:51:23PM +0100, David Howells wrote: > Matthew Wilcox (Oracle) wrote: > > > +struct folio *folio_alloc(gfp_t gfp, unsigned order) > > +{ > > + struct page *page = alloc_pages(gfp | __GFP_COMP, order); > > + > > + if (page && order > 1) > > + prep_transhuge_page(page); > > Ummm... Shouldn't order==1 pages (two page folios) be prep'd also? No. The deferred list is stored in the second tail page, so there's nowhere to store one if there are only two pages. The free_transhuge_page() dtor only handles the deferred list, so it's fine to skip setting the DTOR in the page too. > Would it be better to just jump to alloc_pages() if order <= 1? E.g.: > > struct folio *folio_alloc(gfp_t gfp, unsigned order) > { > struct page *page; > > if (order <= 1) > return (struct folio *)alloc_pages(gfp | __GFP_COMP, order); > > page = alloc_pages(gfp | __GFP_COMP, order); > if (page) > prep_transhuge_page(page); > return (struct folio *)page; > } That doesn't look simpler to me?