From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9433 Path: news.gmane.org!not-for-mail From: Nathan Zadoks Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 0/2] add sched_getcpu, take n+1 Date: Wed, 2 Mar 2016 17:26:25 +0100 Message-ID: <1456935987-24047-1-git-send-email-nathan@nathan7.eu> References: <20160302055542.GN9349@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1456936017 963 80.91.229.3 (2 Mar 2016 16:26:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Mar 2016 16:26:57 +0000 (UTC) Cc: Nathan Zadoks To: musl@lists.openwall.com Original-X-From: musl-return-9446-gllmg-musl=m.gmane.org@lists.openwall.com Wed Mar 02 17:26:56 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ab9bx-0005r2-LR for gllmg-musl@m.gmane.org; Wed, 02 Mar 2016 17:26:53 +0100 Original-Received: (qmail 28638 invoked by uid 550); 2 Mar 2016 16:26:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28541 invoked from network); 2 Mar 2016 16:26:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nathan7.eu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fIavZMoFyEgS/E4sPr5vJM5V+C370dbxL16RkR96Oek=; b=Pp8Kt0M6HOq6Fg7klXwjeSm3Tq5DFg8Y9gstmF03pOeHxa0W5RlovYKsmtWPZAC7w0 ZSNGmlECTa5XXOMt7KRZ+sms48EqVPDFn00fulrISM9gbEktZXqf/05TPdo/vMdL5IAJ /+zOx2HJVn7ecwV348525sqvyDXXmv4lHDjoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fIavZMoFyEgS/E4sPr5vJM5V+C370dbxL16RkR96Oek=; b=D4wdUu4UH3tl7jFd1JkMMwRcf9NTJYlbzp3NF/R4aD0QnvUkMBoBNtVmtAIpxlbcka RBlfqFvFu1zdIVULfIJlGvUVdpaxg8b17D7W5K9AeYgX7ocZlHLjvJCqqlmIr329gM+5 nQrOPMPfCnKB3xUGqspkcDk8PXs6ErLPpmLdslgzDWmGX+6+0mjcCPhpm5jNPm1Apeo5 Tkw1RStfYzJYEkiIzw9mrW5TwrtNofJwc6kEZC0NjwOt6yr9u2gSRJdKqForM4sBjBYL tPn2Dn3bAsydxP2zTIMNOq84L5upIcq0QKlBOe/C3jGtfCzcW6tsVYAakSS2xG0Cii/Q v5xQ== X-Gm-Message-State: AD7BkJKsQPUKODAQTM63MZ0A/bePz5JiPRK4Bo7lCsmX6y4zqxb94KL+R/iGepfozV9T+Q== X-Received: by 10.194.174.197 with SMTP id bu5mr30103108wjc.23.1456935991448; Wed, 02 Mar 2016 08:26:31 -0800 (PST) X-Mailer: git-send-email 2.7.1 In-Reply-To: <20160302055542.GN9349@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:9433 Archived-At: > Wrong macro in the #ifdef. Whoops, thanks, fixed! > Not a big deal, but usually in musl we use 0 rather than the NULL > macro. Learnt a new thing there - fixed! > Actually I wondered if the function actually needs to take the useless > extra 2 arguments, but I think for the sake of correctness it's best > to do it this way -- the callee in the vdso has 3 args, so it should > be called with the correct type. The second argument actually needs to be null: it's an out pointer for an identifier for the NUMA node. sched_getcpu doesn't have a spot for returning it, so we pass a null pointer there, which ignores it. The *third* argument is a pointer to a now-unused cache structure, and could probably be omitted safely. It's required to be non-NULL on kernels older than 2.6.23, but we'd just end up corrupting random memory there instead of getting an EFAULT. Not worth saving a register zeroing instruction. > Also tabs should be used for indention, not spaces. Yup, noticed that one before, was saving the fix for the next patch email. > One other thing I thought might be nice is initially committing the > trivial syscall-only version that adds the public prototype, then > doing vdso support as a separate commit, but if that's a pain to do > don't worry about it. No problem! Some git trickery later, I've got this sorted. Patches coming up in the next two emails, I'm still figuring out this git-send-email thing. Nathan Zadoks (2): add sched_getcpu add sched_getcpu vDSO support arch/x86_64/syscall_arch.h | 2 ++ include/sched.h | 1 + src/sched/sched_getcpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/sched/sched_getcpu.c -- 2.7.1