Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3922587pxt; Tue, 10 Aug 2021 14:55:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGUZK1h7wDg71GiF+K+YAsPsQjQov2n0jvtCzAnoO0CX2aSVX2fa/Lf5WQwpTSPjpUH7ms X-Received: by 2002:a17:906:17c4:: with SMTP id u4mr564277eje.481.1628632519298; Tue, 10 Aug 2021 14:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628632519; cv=none; d=google.com; s=arc-20160816; b=YAKH7VO00CTUgeUaN+5/Nj4ECnao9Am7lxbtnWFj+QEgBIOOeqnyUYyZiU5RUHBHnH LsiBeT1ICj6zhBcEuX9HtyTB0RPNrBCCglE0+RzIzNOoMb60QQJ47IoAOYE+Lztgkk2X gGYNiBaNxWX3M11bPBnKpuALxh2Sq2z/Lu7S+OUYqAVsJbVPDOZI0JbxmC9fYhMQu+Kn O2KDkoMbU5H+nnqKx3p3sJZAB0ZMZvbvVgNU7/fzmBeWnWwgv6rjxf5GRRXQzV2Z7Z0Y WDZ6EBKjlLNTQRzhF8VhAorFZN5IJe2EGZebcXZSLaQSQ7BbleGguPIgnl14BtzYWsIw +WJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=WOJbDaOgR9A4WIv7Hr0VHIDUG6WaV2S/pWdNcf5TSwI=; b=cNBZkjxdMgay9DeJ01B1taZIRl4N3hV24lebRnRPMLwOug2bHdKPmkZ+egAicg/5DH qWJFUw245Qzk4fYboH5q0a3MwbPCxiag6hPbzRGliJ5KIFapkT6qW93ZjSaqrlsA7lRs WWj1H3wmL3BTYxcTDTRz651J9/pUeZcn6DAm/D1o2p9/ZLbsn8ORLUS4nvSvCga9+cVC pfxPwCw45qi7vZNMGdXHuf9PQy67u6lvlMLmGMNaxauWlWjtKyILaO4SGXPLm3VmQy/K NVBQjQJXVGwEanKSl6xD9NvulRgVC9utJqA4NRmV7Y4XmtnkwJkvYAm6poFWxldan17G 7qKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KUIsjMla; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v28si21282414eda.177.2021.08.10.14.54.53; Tue, 10 Aug 2021 14:55:19 -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=@redhat.com header.s=mimecast20190719 header.b=KUIsjMla; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234980AbhHJVvv (ORCPT + 99 others); Tue, 10 Aug 2021 17:51:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41626 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbhHJVvu (ORCPT ); Tue, 10 Aug 2021 17:51:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628632287; h=from:from:reply-to:subject:subject: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=WOJbDaOgR9A4WIv7Hr0VHIDUG6WaV2S/pWdNcf5TSwI=; b=KUIsjMlaoDGU/MWkIYNsaWtDWBnzHOK15ZtADUcmO0rlYj2AT7T9gn6IICak3MzrsdIs0m kcb4zL1fZHFFQMIArvr8uGhYXestHSVXL+bkAMIEPXTYLu6d2+20ROZMoUS6L+clFSQRfG 2/OVwLyhO9/sGxS0EUNHtwf9WSlH2I4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-T7ZIgILRO2iicsiT8o-PHw-1; Tue, 10 Aug 2021 17:51:26 -0400 X-MC-Unique: T7ZIgILRO2iicsiT8o-PHw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2258B1853026; Tue, 10 Aug 2021 21:51:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.22.32.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id F38C760BF1; Tue, 10 Aug 2021 21:51:23 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20210715033704.692967-85-willy@infradead.org> References: <20210715033704.692967-85-willy@infradead.org> <20210715033704.692967-1-willy@infradead.org> To: "Matthew Wilcox (Oracle)" Cc: dhowells@redhat.com, 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1814545.1628632283.1@warthog.procyon.org.uk> Date: Tue, 10 Aug 2021 22:51:23 +0100 Message-ID: <1814546.1628632283@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + return (struct folio *)page; > +} 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; } David