Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbdGER2d (ORCPT ); Wed, 5 Jul 2017 13:28:33 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:40891 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbdGER2b (ORCPT ); Wed, 5 Jul 2017 13:28:31 -0400 X-AuditID: b6c32a2c-f79e76d00000129c-42-595d21b651d9 From: Krzysztof Opasiak To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Krzysztof Opasiak Subject: [PATCH 4/4] mm: Use dedicated helper to access rlimit value Date: Wed, 05 Jul 2017 19:28:11 +0200 Message-id: <20170705172811.8027-1-k.opasiak@samsung.com> X-Mailer: git-send-email 2.9.3 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRmVeSWpSXmKPExsWy7bCmlu42xdhIg6lzLSzmrF/DZnF74jQ2 i8u75rBZ3Fvzn9WBxWPTp0nsHidm/Gbx6NuyitHj8ya5AJYoLpuU1JzMstQifbsErowdv5sY Cz5wVrw8eZe5gfErexcjJ4eEgInEug2LWCBsMYkL99azdTFycQgJLGWU2Hj6DyOE85lRouHc YUaYjiMTfkBV7WCUmLOvnQXC+cUosfvuPqAqDg42AX2JebtEQRpEBGQlpv49D7aCWSBRYlLb QbBBwgIuEv+ffGcFsVkEVCUeTdsGZvMKWEpse7cf6jw5iUvbvjCDzJcQWMMmMe3mJVaQ+RJA QzcdYIaocZGY+e0aVL2wxKvjW6BsKYnujlnsEL3NjBIde56xQDgTGCW2rTsEVWUt8WfVRDaI 6/gken8/YYJYwCvR0SYEYXpILGiRgKh2lHj8dyfYnUICsRJz5y1mncAovYCRYRWjWGpBcW56 arFpgaFecWJucWleul5yfu4mRnAMaunsYLy3wPsQowAHoxIPb8e7mEgh1sSy4srcQ4wSHMxK IrxL3wKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ82qsvBYhJJCeWJKanZpakFoEk2Xi4JRqYJz1 fKNQc5/7RIv+tzeYDXwy/rgI/FjW4G/TX6qyIrS/zV3x6EXHuubJS9gOpSS5c4ZeXbJTNVqy uiry5M7idvt8vmsGR5/P7L3UeeLKKvXjWqpK2y5P+be9ZH1AWWYwTytv1W+264wRG2xbtjdp u83ILNqk1zf77q0nF21yI+bmfoh+E1+5QImlOCPRUIu5qDgRAI8djJ+9AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrELMWRmVeSWpSXmKPExsVy+t9jAd1tirGRBqtX81nMWb+GzeL2xGls Fpd3zWGzuLfmP6sDi8emT5PYPU7M+M3i0bdlFaPH501yASxRbjYZqYkpqUUKqXnJ+SmZeem2 SqEhbroWSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMvY8buJseADZ8XLk3eZ Gxi/sncxcnJICJhIHJnwgw3CFpO4cG89kM3FISSwjVHi0YN/zBDOL0aJKe9msXQxcnCwCehL zNslCtIgIiArMfXveRYQm1kgUeLQuwvMILawgIvE/yffWUFsFgFViUfTtoHZvAKWEtve7Yda LCdxadsX5gmM3AsYGVYxcqUWFOem5xYbFRhtYgSG17bDWgE7GJvORR9iFOBgVOLh7XgXEynE mlhWXJl7iFGCg1lJhHfpW6AQb0piZVVqUX58UWlOavEhRlOglROZpUST84Ghn1cSb2hiaWRi YGZmaGRgbKYkzjsh8EuEkEB6YklqdmpqQWoRTB8TB6dUA2O/h+3XAxVHkhfP+XFqpXls4JbZ 5Yc8D9Ro8C1WmZXucb35vP+MzAV7T8oyftASZ47Iclnu/LBm5SdhgW+f9m/esOq/osHdm6t+ u+kt4Q19NKcndQm7nPoFn1/f7WQ0DQ/3NbiEiU1q1WdXXmqS+mOdpfTEU19v3tOXmrJhxqXn t/cs7pFs0r6kxFKckWioxVxUnAgAMsilg0UCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170705172822epcas5p285c1e58690388b8cb4453d37e968911b X-Msg-Generator: CA X-Sender-IP: 182.195.42.80 X-Local-Sender: =?UTF-8?B?S3J6eXN6dG9mIE9wYXNpYWsbU1JQT0wtU3lzdGVtIChUUCkb?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NvZnR3YXJlIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?S3J6eXN6dG9mIE9wYXNpYWsbU1JQT0wtU3lzdGVtIChUUCkb?= =?UTF-8?B?U2Ftc3VuZ8KgRWxlY3Ryb25pY3MbU29mdHdhcmUgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTY=?= CMS-TYPE: 105P X-CMS-RootMailID: 20170705172822epcas5p285c1e58690388b8cb4453d37e968911b X-RootMTR: 20170705172822epcas5p285c1e58690388b8cb4453d37e968911b References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1222 Lines: 40 Use rlimit() helper instead of manually writing whole chain from current task to rlim_cur Signed-off-by: Krzysztof Opasiak --- mm/mmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index a5e3dcd75e79..8d268b3983c9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2177,7 +2177,6 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow) { struct mm_struct *mm = vma->vm_mm; - struct rlimit *rlim = current->signal->rlim; unsigned long new_start; /* address space limit tests */ @@ -2185,7 +2184,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, return -ENOMEM; /* Stack limit test */ - if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) + if (size > rlimit(RLIMIT_STACK)) return -ENOMEM; /* mlock limit tests */ @@ -2193,7 +2192,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long locked; unsigned long limit; locked = mm->locked_vm + grow; - limit = READ_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur); + limit = rlimit(RLIMIT_MEMLOCK); limit >>= PAGE_SHIFT; if (locked > limit && !capable(CAP_IPC_LOCK)) return -ENOMEM; -- 2.9.3