From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Weimer Subject: Re: [RFC PATCH] getcpu_cache system call: caching current CPU number (x86) Date: Sat, 18 Jul 2015 11:47:53 +0200 Message-ID: <877fpxre46.fsf@mid.deneb.enyo.de> References: <1436724386-30909-1-git-send-email-mathieu.desnoyers@efficios.com> <5CDDBDF2D36D9F43B9F5E99003F6A0D48D5F39C6@PRN-MBX02-1.TheFacebook.com> <587954201.31.1436808992876.JavaMail.zimbra@efficios.com> <5CDDBDF2D36D9F43B9F5E99003F6A0D48D5F5DA0@PRN-MBX02-1.TheFacebook.com> <549319255.383.1437070088597.JavaMail.zimbra@efficios.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org In-Reply-To: <549319255.383.1437070088597.JavaMail.zimbra@efficios.com> (Mathieu Desnoyers's message of "Thu, 16 Jul 2015 18:08:08 +0000 (UTC)") To: Mathieu Desnoyers Cc: Ben Maurer , Paul Turner , Andrew Hunter , Peter Zijlstra , Ingo Molnar , rostedt , "Paul E. McKenney" , Josh Triplett , Lai Jiangshan , Linus Torvalds , Andrew Morton , linux-api , libc-alpha List-Id: linux-api@vger.kernel.org * Mathieu Desnoyers: > The related question then becomes: should we issue this system call once > per process, or once per thread at thread creation ? Issuing it once per > thread is marginally more costly for thread creation, but seems to be > easier to deal with internally within the kernel. I might be missing something, but here is my take: It has to be a per-thread attribute because glibc uses clone internally and wants to set the flag, but the same process may have application or library code which uses clone to create threads, too, but does not know about this new feature. If it's per-process, the existing code would fail. (We may argue indefinitely if this is a supported use case from the glibc point of view, but I'm pretty sure there is code out there which does exactly this, even though it's fairly complicated to get right.)