Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755437AbbGQRDP (ORCPT ); Fri, 17 Jul 2015 13:03:15 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:59710 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbbGQRDK (ORCPT ); Fri, 17 Jul 2015 13:03:10 -0400 X-Originating-IP: 50.43.43.179 Date: Fri, 17 Jul 2015 10:03:00 -0700 From: Josh Triplett To: Ben Maurer Cc: Mathieu Desnoyers , Paul Turner , "linux-kernel@vger.kernel.org" , Andrew Hunter , Peter Zijlstra , Ingo Molnar , Steven Rostedt , "Paul E. McKenney" , Linus Torvalds , Andrew Morton , "linux-api@vger.kernel.org" Subject: Re: [RFC PATCH] thread_local_abi system call: caching current CPU number (x86) Message-ID: <20150717170300.GB1424@x> References: <1437076851-14848-1-git-send-email-mathieu.desnoyers@efficios.com> <5CDDBDF2D36D9F43B9F5E99003F6A0D48D616ED9@PRN-MBX02-1.TheFacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5CDDBDF2D36D9F43B9F5E99003F6A0D48D616ED9@PRN-MBX02-1.TheFacebook.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1159 Lines: 24 On Fri, Jul 17, 2015 at 10:49:19AM +0000, Ben Maurer wrote: > Mathieu Desnoyers wrote: > > Expose a new system call allowing threads to register a userspace memory > > area where to store the current CPU number. Scheduler migration sets the > > I really like that this approach makes it easier to add a per-thread interaction between userspace and the kernel in the future. > > >+ if (!tlap || t->thread_local_abi_len < > >+ offsetof(struct thread_local_abi, cpu) > >+ + sizeof(tlap->cpu)) > > Could you save a branch here by enforcing that thread_local_abi_len = 0 if thread_local_abi = null? "saving a branch" doesn't seem like a good reason to do that; however, it *is* the convention across other calls: if you pass 0, the pointer is ignored, but if you pass non-zero, the pointer must be valid or you get -EFAULT (or an actual segfault). - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/