Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934759AbcKPKS2 (ORCPT ); Wed, 16 Nov 2016 05:18:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbcKPKS1 (ORCPT ); Wed, 16 Nov 2016 05:18:27 -0500 Date: Wed, 16 Nov 2016 11:18:37 +0100 From: Greg KH To: Peter Zijlstra Cc: Kees Cook , Will Deacon , "Reshetova, Elena" , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , David Windsor , LKML , Alexei Starovoitov , Daniel Borkmann Subject: Re: [RFC][PATCH 2/7] kref: Add kref_read() Message-ID: <20161116101837.GA23902@kroah.com> References: <20161114173946.501528675@infradead.org> <20161114174446.486581399@infradead.org> <20161115073322.GC28248@kroah.com> <20161115080314.GD3142@twins.programming.kicks-ass.net> <20161116082151.GA24017@kroah.com> <20161116101042.GN3142@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161116101042.GN3142@twins.programming.kicks-ass.net> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 814 Lines: 23 On Wed, Nov 16, 2016 at 11:10:42AM +0100, Peter Zijlstra wrote: > On Wed, Nov 16, 2016 at 09:21:51AM +0100, Greg KH wrote: > > > What should we do about things like this (bpf_prog_put() and callbacks > > > from kernel/bpf/syscall.c): > > > > > > > > > static void bpf_prog_uncharge_memlock(struct bpf_prog *prog) > > > { > > > struct user_struct *user = prog->aux->user; > > > > > > atomic_long_sub(prog->pages, &user->locked_vm); > > > > Oh that's scary. Let's just make one reference count rely on another > > one and not check things... > > Its not a reference count, its a resource limit thingy. Also, isn't > stacking, or in general building an object graph, the entire point of > reference counts? Ah, that wasn't obvious, but yes, you are correct here, sorry for the noise. greg k-h