From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DEACC43467 for ; Sat, 17 Oct 2020 23:15:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C214214DB for ; Sat, 17 Oct 2020 23:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602976505; bh=zscrx8kxlqwKF9gn/8Q/Wy4GW35yVFNRmCQaMYJkRzA=; h=Date:From:To:Subject:In-Reply-To:Reply-To:List-ID:From; b=d4y1nkyWCIIuD87MEopMxjeItNw+WhlFHBznQwwcRLkx7ABvmzNR3k5eYopUM4t3Z N91wsDoZeVCT7cCojuLWML296Wrdfm2e7fYXDoV3CvZ7v85CUKg96hIw1QG/LyoRgm +MHl6Zuxhb4NR6y7fHZU45N0vKtQ6eqP2Ne2pmsk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439910AbgJQXPF (ORCPT ); Sat, 17 Oct 2020 19:15:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439878AbgJQXPE (ORCPT ); Sat, 17 Oct 2020 19:15:04 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AE37521527; Sat, 17 Oct 2020 23:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602976504; bh=zscrx8kxlqwKF9gn/8Q/Wy4GW35yVFNRmCQaMYJkRzA=; h=Date:From:To:Subject:In-Reply-To:From; b=SRbuA8Ya83LRc+DJO8XSEwceiQp2inV9V4Kbz3KEZzbkbfrW3SySebDXhQsRQf/Cw GhgSkt8ufRV+jMoSYa9fbzozm+jhcsw/wHvUD+/wtsRcPaPYmJn1z1dUoXm+Hpism5 xWzLS3p3Zi/1wAhqEG3+ZK2YYowyjmYj750n3P4I= Date: Sat, 17 Oct 2020 16:15:03 -0700 From: Andrew Morton To: akpm@linux-foundation.org, boris.ostrovsky@oracle.com, chris@chris-wilson.co.uk, hch@lst.de, jani.nikula@linux.intel.com, jgross@suse.com, joonas.lahtinen@linux.intel.com, linux-mm@kvack.org, matthew.auld@intel.com, minchan@kernel.org, mm-commits@vger.kernel.org, ngupta@vflare.org, peterz@infradead.org, rodrigo.vivi@intel.com, sstabellini@kernel.org, torvalds@linux-foundation.org, tvrtko.ursulin@linux.intel.com, urezki@gmail.com, willy@infradead.org Subject: [patch 27/40] mm: update the documentation for vfree Message-ID: <20201017231503.Mq52Vrou6%akpm@linux-foundation.org> In-Reply-To: <20201017161314.88890b87fae7446ccc13c902@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org From: "Matthew Wilcox (Oracle)" Subject: mm: update the documentation for vfree Patch series "remove alloc_vm_area", v4. This series removes alloc_vm_area, which was left over from the big vmalloc interface rework. It is a rather arkane interface, basicaly the equivalent of get_vm_area + actually faulting in all PTEs in the allocated area. It was originally addeds for Xen (which isn't modular to start with), and then grew users in zsmalloc and i915 which seems to mostly qualify as abuses of the interface, especially for i915 as a random driver should not set up PTE bits directly. This patch (of 11): * Document that you can call vfree() on an address returned from vmap() * Remove the note about the minimum size -- the minimum size of a vmalloc allocation is one page * Add a Context: section * Fix capitalisation * Reword the prohibition on calling from NMI context to avoid a double negative Link: https://lkml.kernel.org/r/20201002122204.1534411-1-hch@lst.de Link: https://lkml.kernel.org/r/20201002122204.1534411-2-hch@lst.de Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Christoph Hellwig Cc: Peter Zijlstra Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Tvrtko Ursulin Cc: Chris Wilson Cc: Matthew Auld Cc: Rodrigo Vivi Cc: Minchan Kim Cc: Matthew Wilcox Cc: Nitin Gupta Cc: Uladzislau Rezki (Sony) Signed-off-by: Andrew Morton --- mm/vmalloc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) --- a/mm/vmalloc.c~mm-update-the-documentation-for-vfree +++ a/mm/vmalloc.c @@ -2321,20 +2321,21 @@ static void __vfree(const void *addr) } /** - * vfree - release memory allocated by vmalloc() - * @addr: memory base address + * vfree - Release memory allocated by vmalloc() + * @addr: Memory base address * - * Free the virtually continuous memory area starting at @addr, as - * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If @addr is - * NULL, no operation is performed. + * Free the virtually continuous memory area starting at @addr, as obtained + * from one of the vmalloc() family of APIs. This will usually also free the + * physical memory underlying the virtual allocation, but that memory is + * reference counted, so it will not be freed until the last user goes away. * - * Must not be called in NMI context (strictly speaking, only if we don't - * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling - * conventions for vfree() arch-depenedent would be a really bad idea) + * If @addr is NULL, no operation is performed. * + * Context: * May sleep if called *not* from interrupt context. - * - * NOTE: assumes that the object at @addr has a size >= sizeof(llist_node) + * Must not be called in NMI context (strictly speaking, it could be + * if we have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling + * conventions for vfree() arch-depenedent would be a really bad idea). */ void vfree(const void *addr) { _