Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932617AbcLRMeP (ORCPT ); Sun, 18 Dec 2016 07:34:15 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:39333 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760876AbcLRMeO (ORCPT ); Sun, 18 Dec 2016 07:34:14 -0500 From: Vegard Nossum To: Andrew Morton , Michal Hocko , linux-mm@kvack.org Cc: Peter Zijlstra , "Kirill A . Shutemov" , linux-kernel@vger.kernel.org, Vegard Nossum Subject: [PATCH 4/4] mm: clarify mm_struct.mm_{users,count} documentation Date: Sun, 18 Dec 2016 13:32:29 +0100 Message-Id: <20161218123229.22952-4-vegard.nossum@oracle.com> X-Mailer: git-send-email 2.11.0.1.gaa10c3f In-Reply-To: <20161218123229.22952-1-vegard.nossum@oracle.com> References: <20161218123229.22952-1-vegard.nossum@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1525 Lines: 44 Clarify documentation relating to mm_users and mm_count, and switch to kernel-doc syntax. Signed-off-by: Vegard Nossum --- include/linux/mm_types.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 08d947fc4c59..316c3e1fc226 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -407,8 +407,27 @@ struct mm_struct { unsigned long task_size; /* size of task vm space */ unsigned long highest_vm_end; /* highest vma end address */ pgd_t * pgd; - atomic_t mm_users; /* How many users with user space? */ - atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ + + /** + * @mm_users: The number of users including userspace. + * + * Use mmget()/mmget_not_zero()/mmput() to modify. When this drops + * to 0 (i.e. when the task exits and there are no other temporary + * reference holders), we also release a reference on @mm_count + * (which may then free the &struct mm_struct if @mm_count also + * drops to 0). + */ + atomic_t mm_users; + + /** + * @mm_count: The number of references to &struct mm_struct + * (@mm_users count as 1). + * + * Use mmgrab()/mmdrop() to modify. When this drops to 0, the + * &struct mm_struct is freed. + */ + atomic_t mm_count; + atomic_long_t nr_ptes; /* PTE page table pages */ #if CONFIG_PGTABLE_LEVELS > 2 atomic_long_t nr_pmds; /* PMD page table pages */ -- 2.11.0.1.gaa10c3f