Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3996822pxk; Tue, 22 Sep 2020 07:57:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3uHJYEJj9O3qSVFVr8cSf+C567WuAMmovcQ5lNB5qirBTRmfw9XXsMZxY+PW0oH2Q3yyB X-Received: by 2002:a17:906:3759:: with SMTP id e25mr5224391ejc.281.1600786646056; Tue, 22 Sep 2020 07:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600786646; cv=none; d=google.com; s=arc-20160816; b=sEbDk6fR9Ks790fD+gfKYTihJti6FDwH3qawZbp/NSdV1rlHNzderJtJwoZac9vD33 K/GCKJP5l06WhxYJgCbErAe9yV7d5CiZYMpryXXjWpoW7xY7r6VS1MPmLpnS071wm3B+ Obys9Zb8L4gx2NNZ/buuCGwzvwcrFux7edKQb8BuSRi19XdlNxcr920k1Btm6xsKpf8a +SAs+m1GVDMKcmaD1pI56MuiviPKJRVseCOfg5FV0rMkcidqN618hqRpHCMlk7bI1nhi hjQs2f608vd+gG56ycTE9zjHjwQLa2Vl1hr9UmVWAlPN+1syozmuxcT0s2n0R8D8F5U+ pP0Q== 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=PwB7PgSBMCf1i80JEZZeqaAM6Spcvmy9ewYyeFjPsVI=; b=coyO9OZ0xAir6uKAM9Dzo30ZAtUk5GjLvR4+7vf3GoleGOJ30flJ5refPcJN5Yg2Nk C6LYsV4mGhNs4DXaejSLSsLyQWntCNrnoINC7KWkiv/DxQYiogWZ8KABZ7RtsPdNlEGp Csl4LCBeYWtCceQUvYA1wHcKdptU3K7Sq48muVN4ecgRWncRbBoVwOGwJfS6R3FVjB/Z yDYuP2SmSS/fFiXMqzbEeAn3X8Ul7m2y+6jPyrC4hhiK7wO3oX+d8Y+zuTrMJ/FTiQxc ltPvG2YjQDvmhzFo2MsQoLuw+O6xLHsudWhY9FqnpIzCTsPvncinZfcVMrvotBaMdnpu sX0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uqlDPU6S; 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 h1si10773354ejg.341.2020.09.22.07.57.01; Tue, 22 Sep 2020 07:57:26 -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=uqlDPU6S; 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 S1726628AbgIVOxo (ORCPT + 99 others); Tue, 22 Sep 2020 10:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726507AbgIVOxo (ORCPT ); Tue, 22 Sep 2020 10:53:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37FFAC061755 for ; Tue, 22 Sep 2020 07:53:44 -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=PwB7PgSBMCf1i80JEZZeqaAM6Spcvmy9ewYyeFjPsVI=; b=uqlDPU6SPAe3x1DDKo8G1qtut1 YwG3PA4mc8CLJ1oJyPiko0/UbU5ybdUeleXBeV8YHEyvVNYLAMBaj9YGVnr8/JyuAmcKGkiiTdejs bVQysHpa55j4+LiObyETCdlPouw9Nwil/VnTPyLQvh9hBrpeU/Wmc3llTMeW/vjL27ShndfDs1p17 1HtwFHqpD+N1OhT15+cuZIdFzM2p+uhSCE063YoA7faH9tQzfuFItic4W+TEbWs9VLsTKgtP5hMCZ z1+P1JChn7/bURfHcxuqNO0QLmQHNZ4osoavXcBcFeMSltMsN9VNgTTTzxDcDVb8dMbZA2ChSspNL P4owvfJg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKjfX-0001op-62; Tue, 22 Sep 2020 14:53:23 +0000 Date: Tue, 22 Sep 2020 15:53:23 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: Andrew Morton , Peter Zijlstra , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Minchan Kim , Nitin Gupta , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Subject: Re: [PATCH 3/6] drm/i915: use vmap in shmem_pin_map Message-ID: <20200922145323.GG32101@casper.infradead.org> References: <20200918163724.2511-1-hch@lst.de> <20200918163724.2511-4-hch@lst.de> <20200921191157.GX32101@casper.infradead.org> <20200922062249.GA30831@lst.de> <20200922112144.GB32101@casper.infradead.org> <20200922143906.GB26664@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922143906.GB26664@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 04:39:06PM +0200, Christoph Hellwig wrote: > On Tue, Sep 22, 2020 at 12:21:44PM +0100, Matthew Wilcox wrote: > > Actually, vfree() will work today; I cc'd you on a documentation update > > to make it clear that this is permitted. > > vfree calls __free_pages, the i915 and a lot of other code calls > put_page. They are mostly the same, but not quite and everytime I > look into that mess I'm more confused than before. > > Can someone in the know write sensible documentation on when to use > __free_page(s) vs put_page? I started on that, and then I found a bug that's been lurking for 12 years, so that delayed the documentation somewhat. The short answer is that __free_pages() lets you free non-compound high-order pages while put_page() can only free order-0 and compound pages. I would really like to overhaul our memory allocation APIs: current new __get_free_page(s) alloc_page(s) free_page(s) free_page(s) alloc_page(s) get_free_page(s) __free_pages put_page_order Then put_page() and put_page_order() are more obviously friends. But I cannot imagine a world in which Linus says yes to that upheaval. He's previous expressed dislike of the get_free_page() family of APIs, and thinks all those callers should just use kmalloc(). Maybe we can make that transition happen, now that kmalloc() aligns larger allocations.