From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id D30786B0005 for ; Fri, 15 Jul 2016 13:39:41 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id r190so20602360wmr.0 for ; Fri, 15 Jul 2016 10:39:41 -0700 (PDT) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com. [2a00:1450:400c:c09::242]) by mx.google.com with ESMTPS id r8si1877722wjr.136.2016.07.15.10.39.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2016 10:39:40 -0700 (PDT) Received: by mail-wm0-x242.google.com with SMTP id x83so3018146wma.3 for ; Fri, 15 Jul 2016 10:39:40 -0700 (PDT) Subject: Re: [PATCH 09/14] resource limits: track highwater mark of locked memory References: <1468578983-28229-1-git-send-email-toiwoton@gmail.com> <1468578983-28229-10-git-send-email-toiwoton@gmail.com> <20160715151408.GA32317@redhat.com> From: Topi Miettinen Message-ID: <5c43bc33-6625-ceb7-e96e-adf7df5b642c@gmail.com> Date: Fri, 15 Jul 2016 17:39:26 +0000 MIME-Version: 1.0 In-Reply-To: <20160715151408.GA32317@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Oleg Nesterov Cc: linux-kernel@vger.kernel.org, Tony Luck , Fenghua Yu , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Alexander Graf , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Doug Ledford , Sean Hefty , Hal Rosenstock , Mike Marciniszyn , Dennis Dalessandro , Christian Benvenuti , Dave Goodell , Sudeep Dutt , Ashutosh Dixit , Alex Williamson , Alexei Starovoitov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Andrew Morton , Jiri Slaby , Konstantin Khlebnikov , Cyrill Gorcunov , Dave Hansen , Thomas Gleixner , Greg Kroah-Hartman , Dan Carpenter , Vlastimil Babka , Michal Hocko , "Kirill A. Shutemov" , Eric B Munson , Alexey Klimov , Andrea Arcangeli , Chen Gang , Andrey Ryabinin , David Rientjes , Hugh Dickins , Alexander Kuleshov , "open list:IA64 (Itanium) PLATFORM" , "open list:KERNEL VIRTUAL MACHINE (KVM)" , "open list:KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC" , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , "open list:INFINIBAND SUBSYSTEM" , "open list:BPF (Safe dynamic programs and tools)" , "open list:MEMORY MANAGEMENT" On 07/15/16 15:14, Oleg Nesterov wrote: > On 07/15, Topi Miettinen wrote: >> >> Track maximum size of locked memory, to be able to configure >> RLIMIT_MEMLOCK resource limits. The information is available >> with taskstats and cgroupstats netlink socket. > > So I personally still dislike the very idea of this series... but I won't > argue if you convince maintainers. > >> @@ -2020,6 +2020,10 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns >> return -ENOMEM; >> >> update_resource_highwatermark(RLIMIT_STACK, actual_size); >> + if (vma->vm_flags & VM_LOCKED) >> + update_resource_highwatermark(RLIMIT_MEMLOCK, >> + (mm->locked_vm + grow) << >> + PAGE_SHIFT); > > Btw this is not right. The same for the previous patch which tracks > RLIMIT_STACK. The "current" task can debugger/etc. acct_stack_growth() is called from expand_upwards() and expand_downwards(). They call security_mmap_addr() and the various LSM implementations also use current task in the checks. Are these also not right? > > Yes, yes, this just reminds that the whole rlimit logic in this path > is broken but still... I'd be happy to fix the logic with a separate prerequisite patch and then use the right logic for this patch, but I'm not sure I know how. Could you elaborate a bit? -Topi > > Oleg. > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org