All of lore.kernel.org
 help / color / mirror / Atom feed
From: Topi Miettinen <toiwoton@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, "Tony Luck" <tony.luck@intel.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Alexander Graf" <agraf@suse.com>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Doug Ledford" <dledford@redhat.com>,
	"Sean Hefty" <sean.hefty@intel.com>,
	"Hal Rosenstock" <hal.rosenstock@gmail.com>,
	"Mike Marciniszyn" <mike.marciniszyn@intel.com>,
	"Dennis Dalessandro" <dennis.dalessandro@intel.com>,
	"Christian Benvenuti" <benve@cisco.com>,
	"Dave Goodell" <dgoodell@cisco.com>,
	"Sudeep Dutt" <sudeep.dutt@intel.com>,
	"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>
Subject: Re: [PATCH 09/14] resource limits: track highwater mark of locked memory
Date: Fri, 15 Jul 2016 17:39:26 +0000	[thread overview]
Message-ID: <5c43bc33-6625-ceb7-e96e-adf7df5b642c@gmail.com> (raw)
In-Reply-To: <20160715151408.GA32317@redhat.com>

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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Topi Miettinen <toiwoton@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, "Tony Luck" <tony.luck@intel.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Alexander Graf" <agraf@suse.com>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Doug Ledford" <dledford@redhat.com>,
	"Sean Hefty" <sean.hefty@intel.com>,
	"Hal Rosenstock" <hal.rosenstock@gmail.com>,
	"Mike Marciniszyn" <mike.marciniszyn@intel.com>,
	"Dennis Dalessandro" <dennis.dalessandro@intel.com>,
	"Christian Benvenuti" <benve@cisco.com>,
	"Dave Goodell" <dgoodell@cisco.com>,
	"Sudeep Dutt" <sudeep.dutt@intel.com>,
	"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jiri Slaby" <jslaby@suse.cz>,
	"Konstantin Khlebnikov" <koct9i@gmail.com>,
	"Cyrill Gorcunov" <gorcunov@openvz.org>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Michal Hocko" <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Eric B Munson" <emunson@akamai.com>,
	"Alexey Klimov" <klimov.linux@gmail.com>,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"Chen Gang" <gang.chen.5i5j@gmail.com>,
	"Andrey Ryabinin" <aryabinin@virtuozzo.com>,
	"David Rientjes" <rientjes@google.com>,
	"Hugh Dickins" <hughd@google.com>,
	"Alexander Kuleshov" <kuleshovmail@gmail.com>,
	"open list:IA64 (Itanium) PLATFORM" <linux-ia64@vger.kernel.org>,
	"open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@vger.kernel.org>,
	"open list:KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC"
	<kvm-ppc@vger.kernel.org>,
	"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
	<linuxppc-dev@lists.ozlabs.org>,
	"open list:INFINIBAND SUBSYSTEM" <linux-rdma@vger.kernel.org>,
	"open list:BPF (Safe dynamic programs and tools)"
	<netdev@vger.kernel.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH 09/14] resource limits: track highwater mark of locked memory
Date: Fri, 15 Jul 2016 17:39:26 +0000	[thread overview]
Message-ID: <5c43bc33-6625-ceb7-e96e-adf7df5b642c@gmail.com> (raw)
In-Reply-To: <20160715151408.GA32317@redhat.com>

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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Topi Miettinen <toiwoton@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, "Tony Luck" <tony.luck@intel.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Alexander Graf" <agraf@suse.com>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Doug Ledford" <dledford@redhat.com>,
	"Sean Hefty" <sean.hefty@intel.com>,
	"Hal Rosenstock" <hal.rosenstock@gmail.com>,
	"Mike Marciniszyn" <mike.marciniszyn@intel.com>,
	"Dennis Dalessandro" <dennis.dalessandro@intel.com>,
	"Christian Benvenuti" <benve@cisco.com>,
	"Dave Goodell" <dgoodell@cisco.com>,
	"Sudeep Dutt" <sudeep.dutt@intel.com>,
	"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jiri Slaby" <jslaby@suse.cz>,
	"Konstantin Khlebnikov" <koct9i@gmail.com>,
	"Cyrill Gorcunov" <gorcunov@openvz.org>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Michal Hocko" <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Eric B Munson" <emunson@akamai.com>,
	"Alexey Klimov" <klimov.linux@gmail.com>,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"Chen Gang" <gang.chen.5i5j@gmail.com>,
	"Andrey Ryabinin" <aryabinin@virtuozzo.com>,
	"David Rientjes" <rientjes@google.com>,
	"Hugh Dickins" <hughd@google.com>,
	"Alexander Kuleshov" <kuleshovmail@gmail.com>,
	"open list:IA64 (Itanium) PLATFORM" <linux-ia64@vger.kernel.org>,
	"open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@vger.kernel.org>,
	"open list:KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC"
	<kvm-ppc@vger.kernel.org>,
	"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
	<linuxppc-dev@lists.ozlabs.org>,
	"open list:INFINIBAND SUBSYSTEM" <linux-rdma@vger.kernel.org>,
	"open list:BPF (Safe dynamic programs and tools)"
	<netdev@vger.kernel.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH 09/14] resource limits: track highwater mark of locked memory
Date: Fri, 15 Jul 2016 17:39:26 +0000	[thread overview]
Message-ID: <5c43bc33-6625-ceb7-e96e-adf7df5b642c@gmail.com> (raw)
In-Reply-To: <20160715151408.GA32317@redhat.com>

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.
> 

  reply	other threads:[~2016-07-15 17:39 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 10:35 [PATCH 00/14] Present useful limits to user (v2) Topi Miettinen
2016-07-15 10:35 ` Topi Miettinen
2016-07-15 10:35 ` Topi Miettinen
2016-07-15 10:35 ` Topi Miettinen
2016-07-15 10:35 ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 01/14] resource limits: foundation for resource highwater tracking Topi Miettinen
2016-07-15 12:12   ` kbuild test robot
2016-07-15 12:49   ` Nicolas Dichtel
2016-07-15 16:27     ` Topi Miettinen
2016-07-15 17:57       ` Nicolas Dichtel
2016-07-15 10:35 ` [PATCH 02/14] resource limits: aggregate task highwater marks to cgroup level Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 12:38   ` kbuild test robot
2016-07-15 14:10   ` Tejun Heo
2016-07-15 17:15     ` Topi Miettinen
2016-07-18 22:52       ` Tejun Heo
2016-07-19 16:57         ` Topi Miettinen
2016-07-19 18:18           ` Tejun Heo
2016-07-15 10:35 ` [PATCH 03/14] resource limits: track highwater mark of file sizes Topi Miettinen
2016-07-15 10:35 ` [PATCH 04/14] resource limits: track highwater mark of VM data segment Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 05/14] resource limits: track highwater mark of stack size Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 06/14] resource limits: track highwater mark of cores dumped Topi Miettinen
2016-07-15 10:35 ` [PATCH 07/14] resource limits: track highwater mark of user processes Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 08/14] resource limits: track highwater mark of number of files Topi Miettinen
2016-07-15 10:35 ` [PATCH 09/14] resource limits: track highwater mark of locked memory Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 15:14   ` Oleg Nesterov
2016-07-15 15:14     ` Oleg Nesterov
2016-07-15 15:14     ` Oleg Nesterov
2016-07-15 17:39     ` Topi Miettinen [this message]
2016-07-15 17:39       ` Topi Miettinen
2016-07-15 17:39       ` Topi Miettinen
2016-07-18 15:38       ` Oleg Nesterov
2016-07-18 15:38         ` Oleg Nesterov
2016-07-18 15:38         ` Oleg Nesterov
2016-07-15 17:45   ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 10/14] resource limits: track highwater mark of address space size Topi Miettinen
2016-07-15 10:35   ` Topi Miettinen
2016-07-15 10:35 ` [PATCH 11/14] resource limits: track highwater mark of number of pending signals Topi Miettinen
2016-07-15 10:35 ` [PATCH 12/14] resource limits: track highwater mark of size of message queues Topi Miettinen
2016-07-15 10:36 ` [PATCH 13/14] resource limits: track highwater mark of niceness Topi Miettinen
2016-07-15 10:36 ` [PATCH 14/14] resource limits: track highwater mark of RT priority Topi Miettinen
2016-07-15 12:43 ` [PATCH 00/14] Present useful limits to user (v2) Peter Zijlstra
2016-07-15 12:43   ` Peter Zijlstra
2016-07-15 12:43   ` Peter Zijlstra
2016-07-15 13:52   ` Topi Miettinen
2016-07-15 13:52     ` Topi Miettinen
2016-07-15 13:52     ` Topi Miettinen
2016-07-15 13:59     ` Peter Zijlstra
2016-07-15 13:59       ` Peter Zijlstra
2016-07-15 13:59       ` Peter Zijlstra
2016-07-15 13:59       ` Peter Zijlstra
2016-07-15 13:59       ` Peter Zijlstra
2016-07-15 16:57       ` Topi Miettinen
2016-07-15 16:57         ` Topi Miettinen
2016-07-15 16:57         ` Topi Miettinen
2016-07-15 16:57         ` Topi Miettinen
2016-07-15 20:54       ` H. Peter Anvin
2016-07-15 20:54       ` H. Peter Anvin
2016-07-15 20:54         ` H. Peter Anvin
2016-07-15 20:54         ` H. Peter Anvin
2016-07-15 20:54         ` H. Peter Anvin
2016-07-18 13:00         ` Austin S. Hemmelgarn
     [not found]       ` <20160715135956.GA3115-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2016-07-15 20:54         ` H. Peter Anvin
2016-07-15 20:54         ` H. Peter Anvin
2016-07-15 20:54       ` H. Peter Anvin
2016-07-15 20:54       ` H. Peter Anvin
2016-07-15 13:04 ` Balbir Singh
2016-07-15 13:04   ` Balbir Singh
2016-07-15 13:04   ` Balbir Singh
2016-07-15 16:35   ` Topi Miettinen
2016-07-15 16:35     ` Topi Miettinen
2016-07-15 16:35     ` Topi Miettinen
2016-07-18 22:05     ` Doug Ledford
2016-07-18 22:05       ` Doug Ledford
2016-07-19 16:53       ` Topi Miettinen
2016-07-19 16:53         ` Topi Miettinen
2016-07-19 16:53         ` Topi Miettinen
2016-07-15 14:19 ` Richard Weinberger
2016-07-15 14:19   ` Richard Weinberger
2016-07-15 14:19   ` Richard Weinberger
2016-07-15 17:19   ` Topi Miettinen
2016-07-15 17:19     ` Topi Miettinen
2016-07-15 17:19     ` Topi Miettinen
2016-07-18 21:25   ` Doug Ledford
2016-07-18 21:25     ` Doug Ledford
2016-07-15 17:42 ` Topi Miettinen
2016-08-03 18:20 ` Topi Miettinen
2016-08-03 18:20   ` Topi Miettinen
2016-08-04  6:59   ` Fwd: " Topi Miettinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c43bc33-6625-ceb7-e96e-adf7df5b642c@gmail.com \
    --to=toiwoton@gmail.com \
    --cc=agraf@suse.com \
    --cc=alex.williamson@redhat.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=ast@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=benve@cisco.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=dgoodell@cisco.com \
    --cc=dledford@redhat.com \
    --cc=fenghua.yu@intel.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=oleg@redhat.com \
    --cc=paulus@samba.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rkrcmar@redhat.com \
    --cc=sean.hefty@intel.com \
    --cc=sudeep.dutt@intel.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.