Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1740463yba; Sun, 14 Apr 2019 19:25:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzob0jdpIC7cEN3wUSKe8zIjJs6PPHxD+R3rPMCFIE+eQh1Nfg8CGoPBL0mymlH3LGKDaxq X-Received: by 2002:a63:6ac1:: with SMTP id f184mr63579107pgc.25.1555295141832; Sun, 14 Apr 2019 19:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555295141; cv=none; d=google.com; s=arc-20160816; b=1C5KuImc5JLyqEuJ5hTr9+cuJd9iT7AXQrEhvP1IgYByRmpgS1tWN+20WvhHur4b2U Thf05ooLd9d5TObekp2bLlH1L9m4JYV2DAH1aYzPeD++OTGM0b0qp7qpIMNnVriZRaYc lRCXC03eu8YcFLPg1wBBxqKfnbJ2NfCipLY31NsmEBaxQPuSKmwARANWdqWv51dDs4Tu wd68M5ttO2B1mH/cmDYtZ8A06fIr9NgZifaLw9Mlacs8S7/1Bq/90qRCz9hWUkZNZAie 6yzioTqvrr3sbFyHu/a13Sqgx7S+/dibzmBhyM38e0cv9QbSoii9V/MtnrUsbDWxOwh2 9QYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aB6g0E//NkNVlipKG0sOhrOyS6Dw+DkFuHN89+1UXTY=; b=WT4MsyMu2uVX3/0gcmiDyuQ3O4KEtQ2BtZWKnxl4TwXMdsY2Ipmezjoo3jluC/+ayZ 0DTimUVJqwKwcBAi0hnvTRvfzRjwu2zcfU7QuUTcGqNVyg9Y8J8NdUJFJTKaKjgJznLK MNWizsut1gRmyr12fq95jkJymxSZnYqoigEu5Z7kg3dCoOWid8zWORqcSqEIOcLbi/8L xrpWdJLj5JoUKLUskFzdaF4a6QXnhc3LERouMl3spxvGdaYp8LXi+dFoNZ19NceMixaK oaNHpPnW5StG0jewDSFos/MtGXJBimXupbpOEXLG7Pkn9pUfyuUIpkDA97H9ZlYxnWQa mvKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fq0EfNQX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si30673430plo.300.2019.04.14.19.25.12; Sun, 14 Apr 2019 19:25:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=fq0EfNQX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726399AbfDOCYP (ORCPT + 99 others); Sun, 14 Apr 2019 22:24:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51310 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfDOCYP (ORCPT ); Sun, 14 Apr 2019 22:24:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aB6g0E//NkNVlipKG0sOhrOyS6Dw+DkFuHN89+1UXTY=; b=fq0EfNQX5nmmKBJBSToMWL+EU FxkpnJG2cnRAHFxr+1W/jqEJiVT7FnrH9KpPttGpFx/T7D9QeyyP6ORiCBXLzW0CSHJgygexR8OEv LGgRxRk6rGqLCiZ7KvkazpzS3Ut3DXqH6MarjmuEo/wxSBFEb4VLhMJFLX2C6dc8tHn3KZ57MypRf c2AG1z6qj6Gzc7hj5pNwfP3/xYm+JbK/igIaiG/xhkuvqKjv3NBQNiY/SumzLQQ7HXAPm7ggHF4Go ds5GKrGU3C1kVsilweVs8h7utQitrg4S1CeaHlkJaGpFenphFG+mPP5NG7MCoitqRzYgwVPBWPZ+E cpkaKGf7g==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFrI4-0005Pf-K4; Mon, 15 Apr 2019 02:24:12 +0000 Date: Sun, 14 Apr 2019 19:24:12 -0700 From: Matthew Wilcox To: Kees Cook Cc: Eric Biggers , Rik van Riel , linux-crypto , Herbert Xu , Dmitry Vyukov , Geert Uytterhoeven , linux-security-module , Linux ARM , Linux Kernel Mailing List , Laura Abbott , linux-mm@kvack.org Subject: Re: [PATCH] crypto: testmgr - allocate buffers with __GFP_COMP Message-ID: <20190415022412.GA29714@bombadil.infradead.org> References: <20190411192607.GD225654@gmail.com> <20190411192827.72551-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 11, 2019 at 01:32:32PM -0700, Kees Cook wrote: > > @@ -156,7 +156,8 @@ static int __testmgr_alloc_buf(char *buf[XBUFSIZE], int order) > > int i; > > > > for (i = 0; i < XBUFSIZE; i++) { > > - buf[i] = (char *)__get_free_pages(GFP_KERNEL, order); > > + buf[i] = (char *)__get_free_pages(GFP_KERNEL | __GFP_COMP, > > + order); > > Is there a reason __GFP_COMP isn't automatically included in all page > allocations? (Or rather, it seems like the exception is when things > should NOT be considered part of the same allocation, so something > like __GFP_SINGLE should exist?.) The question is not whether or not things should be considered part of the same allocation. The question is whether the allocation is of a compound page or of N consecutive pages. Now you're asking what the difference is, and it's whether you need to be able to be able to call compound_head(), compound_order(), PageTail() or use a compound_dtor. If you don't, then you can save some time at allocation & free by not specifying __GFP_COMP. I'll agree this is not documented well, and maybe most multi-page allocations do want __GFP_COMP and we should invert that bit, but __GFP_SINGLE doesn't seem like the right antonym to __GFP_COMP to me.