From patchwork Sun Nov 11 16:48:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10677739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6738613AD for ; Sun, 11 Nov 2018 16:49:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5580C2A56D for ; Sun, 11 Nov 2018 16:49:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46B8A2A574; Sun, 11 Nov 2018 16:49:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04A892A56D for ; Sun, 11 Nov 2018 16:48:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6567A6B0003; Sun, 11 Nov 2018 11:48:57 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5E0656B0005; Sun, 11 Nov 2018 11:48:57 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47FFD6B0006; Sun, 11 Nov 2018 11:48:57 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 0168A6B0003 for ; Sun, 11 Nov 2018 11:48:57 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id g24-v6so5779994pfi.23 for ; Sun, 11 Nov 2018 08:48:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=OwgEN4r0TJ0wWwyT/RTOin+bg4c1zDirWaTQoTqR0y4=; b=Qe8MugotjgQx7DmVaGRS9JBov6eCCeY8SyTQR7apFJcPomaK+/cDPU63BqbOI+gyXs VtFyTqZpmPzgwSf7FA8Fc+3Q0pfNKQPVlqbHtQ+RMlRuvt3Na6qYIaEd1yuNyj/qD96A ty+RoqG3CM2ECk2kW5l2Msgf4ww61vO4gaE/ppbtJu3noi5VThlBKN+cdkjNq2rEkG+m T0U3A67je8MszAPHbGvQxGnR+qj+jsrZhVvgzif9YrFZ4uq/zpj1gke+5e4MC5TvkIIN C1FP9n2FdjaGZE/zQuf2YAYCm3YjN6JJNX5jMtrXca0wIXik5JoaIJeoliKhJtrHyxsD 3uZg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gIfAKzXDXj6iQinvVvbbF2grS4ku+7YHgjqYVrddMVnpOOdcXCA IoIwlrvP+DsrjplfRjR09+tni5n8ng4eJu5aauEUY5TTTLpsQuYJWuosPhHo8PDQeyBSyPkBR9F MdrhYPbi6W61O8QcuH/qSk/kVdeHdhyN6BpOSlmfaIbXSV60JnFfTcQi44I6ZXOBlxg== X-Received: by 2002:a62:6455:: with SMTP id y82-v6mr4735153pfb.249.1541954936614; Sun, 11 Nov 2018 08:48:56 -0800 (PST) X-Google-Smtp-Source: AJdET5c7Eamue16ZM72qeFZDd3YypOB8840VXkmbqiNfFy7mu/M9imn3ZezZ7hc+l0CZbF6/Wycv X-Received: by 2002:a62:6455:: with SMTP id y82-v6mr4735109pfb.249.1541954935592; Sun, 11 Nov 2018 08:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541954935; cv=none; d=google.com; s=arc-20160816; b=AMKEW9CDjn3ZBPjEyps/MFzUMlGiub/qG0xETonsG/9xUVf1ZYtrST4gyNRgoolOS9 jqvSQGvL51cof8+rdRXHHQ/YdXUf9v1VlOMr/WovBcqS9zsMGuBUbl26U87ZQdeR6BMt U3BlgI8A4KO9Gbap7CyCMqp2XD1MdbrZb0H8SyMa/aEXrQGTKe1PP5zwqPNWgfeI3NPT VEDIU0C1djC+9jL5uwAo7iEd46kxFnncMmIgU4/PI9U0Kg8YC2JalnGQBYoFbYbFwiKl AXTZitcT89pWFuxg4C3bgJP4ghg96iC0EIYONGycnO7mO+/trNc7MzM7XguzOjPsbQh4 1w6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=OwgEN4r0TJ0wWwyT/RTOin+bg4c1zDirWaTQoTqR0y4=; b=GUwToP4bNX/rBFZ9dM+VRnJUHY4qqEwqD5UZejmQdgZ5oyOAGCjWYigjefYfVDADoe tKER6HEaplUpLqDaQJJz8MLK2ikD3zj7exWHBGJ3YTLX02I5SgtfxiIYpmfgu5jkF10o UnZpotLopYJpSiwV2sf5p5f6KCNTdmNkB/cGr9Z/HdWpS2b5agdq8djNRPIcaJTQKwww nuEphlKF+o9BM0tutUjgfOpnzWqraKcwtPPQPW24tWIkSnj8bIKAbNMLDR1fa0bvJQ/K ocbQrroZA8mbtuBIvHC9ZNxDK6uj5ZI2fZn1pttIkrCZd7rjYvdpVFBJ51nSBUSdU+fk OXtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id n33si12987302pgl.336.2018.11.11.08.48.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Nov 2018 08:48:55 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wABGjJOT088949 for ; Sun, 11 Nov 2018 11:48:54 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2npd75vxce-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 11 Nov 2018 11:48:54 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 11 Nov 2018 16:48:52 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 11 Nov 2018 16:48:49 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wABGmmwf39649358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 11 Nov 2018 16:48:48 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4142452050; Sun, 11 Nov 2018 16:48:48 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.206.171]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id A35F45204E; Sun, 11 Nov 2018 16:48:46 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 11 Nov 2018 18:48:45 +0200 From: Mike Rapoport To: Jonathan Corbet Cc: Randy Dunlap , Andrew Morton , linux-doc@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: [PATCH] docs/mm: update kmalloc kernel-doc description Date: Sun, 11 Nov 2018 18:48:44 +0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18111116-0008-0000-0000-000002911A78 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111116-0009-0000-0000-000021FB21C2 Message-Id: <1541954924-21471-1-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-11_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811110160 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Add references to GFP documentation and the memory-allocation.rst and remove GFP_USER, GFP_DMA and GFP_NOIO descriptions. While on it slightly change the formatting so that the list of GFP flags will be rendered as "description" in the generated html. Signed-off-by: Mike Rapoport --- Probably this should go via the -mm tree as it touches include/linux/slab.h Documentation/core-api/memory-allocation.rst | 2 + include/linux/slab.h | 55 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Documentation/core-api/memory-allocation.rst b/Documentation/core-api/memory-allocation.rst index f8bb9aa..39f35eb 100644 --- a/Documentation/core-api/memory-allocation.rst +++ b/Documentation/core-api/memory-allocation.rst @@ -1,3 +1,5 @@ +.. _memory_allocation: + ======================= Memory Allocation Guide ======================= diff --git a/include/linux/slab.h b/include/linux/slab.h index 918f374..4a342eb 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -486,48 +486,47 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) * kmalloc is the normal method of allocating memory * for objects smaller than page size in the kernel. * - * The @flags argument may be one of: + * The @flags argument may be one of the GFP flags defined at + * include/linux/gfp.h and described at + * :ref:`Documentation/core-api/mm-api.rst ` * - * %GFP_USER - Allocate memory on behalf of user. May sleep. + * The recommended usage of the @flags is described at + * :ref:`Documentation/core-api/memory-allocation.rst ` * - * %GFP_KERNEL - Allocate normal kernel ram. May sleep. + * Below is a brief outline of the most useful GFP flags * - * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools. - * For example, use this inside interrupt handlers. + * %GFP_KERNEL + * Allocate normal kernel ram. May sleep. * - * %GFP_HIGHUSER - Allocate pages from high memory. + * %GFP_NOWAIT + * Allocation will not sleep. * - * %GFP_NOIO - Do not do any I/O at all while trying to get memory. + * %GFP_ATOMIC + * Allocation will not sleep. May use emergency pools. * - * %GFP_NOFS - Do not make any fs calls while trying to get memory. - * - * %GFP_NOWAIT - Allocation will not sleep. - * - * %__GFP_THISNODE - Allocate node-local memory only. - * - * %GFP_DMA - Allocation suitable for DMA. - * Should only be used for kmalloc() caches. Otherwise, use a - * slab created with SLAB_DMA. + * %GFP_HIGHUSER + * Allocate memory from high memory on behalf of user. * * Also it is possible to set different flags by OR'ing * in one or more of the following additional @flags: * - * %__GFP_HIGH - This allocation has high priority and may use emergency pools. - * - * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail - * (think twice before using). + * %__GFP_HIGH + * This allocation has high priority and may use emergency pools. * - * %__GFP_NORETRY - If memory is not immediately available, - * then give up at once. + * %__GFP_NOFAIL + * Indicate that this allocation is in no way allowed to fail + * (think twice before using). * - * %__GFP_NOWARN - If allocation fails, don't issue any warnings. + * %__GFP_NORETRY + * If memory is not immediately available, + * then give up at once. * - * %__GFP_RETRY_MAYFAIL - Try really hard to succeed the allocation but fail - * eventually. + * %__GFP_NOWARN + * If allocation fails, don't issue any warnings. * - * There are other flags available as well, but these are not intended - * for general use, and so are not documented here. For a full list of - * potential flags, always refer to linux/gfp.h. + * %__GFP_RETRY_MAYFAIL + * Try really hard to succeed the allocation but fail + * eventually. */ static __always_inline void *kmalloc(size_t size, gfp_t flags) {