From owner-freebsd-arch@freebsd.org Tue Nov 14 02:10:35 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFBF4C7E489 for ; Tue, 14 Nov 2017 02:10:35 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3E5368519 for ; Tue, 14 Nov 2017 02:10:35 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: by mcvoy.com (Postfix, from userid 3546) id 693BB35E130; Mon, 13 Nov 2017 18:01:38 -0800 (PST) Date: Mon, 13 Nov 2017 18:01:38 -0800 From: Larry McVoy To: freebsd-arch@freebsd.org Cc: kbowling@llnw.com, gallatin@netflix.com, scottl@netflix.com Subject: small patch for numactl. Comments? Message-ID: <20171114020138.GA18863@mcvoy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 02:10:35 -0000 Hi folks, some CDN people are dragging me out of retirement to work on FreeBSD. Which I have to say is sort of fun since I started my kernel hacking on SunOS 4.x which was a very very nice version of BSD. But FreeBSD has mostly caught up, so it's pleasant. I'm wacking LMbench to be numa aware and this patch would help me make sure that when you are a numa machine you could insist that people run the benchmark via numactl (imma gonna blog about numa, it sucks unless you are numa aware). I did some docs but I'm new to the FreeBSD man macros, would love feedback on how to do that right. --- numactl.1 2017-11-13 17:51:26.243473000 -0800 +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 @@ -107,6 +107,15 @@ .El .Sh EXIT STATUS .Ex -std +.Sh ENVIRONMENT +.Nm +sets the environment variable +\fINUMACTL=YES\fP +before running +.Ar cmd ... +so that programs that know that they need to be run under +.Nm +can check. .Sh EXAMPLES Create a .Pa /bin/sh --- numactl.c 2017-11-13 16:18:36.134359000 -0800 +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 @@ -231,6 +231,7 @@ (void) set_numa_domain_cpuaffinity(cpu_domain, CPU_WHICH_PID, -1); + putenv("NUMACTL=YES"); errno = 0; execvp(*argv, argv); err(errno == ENOENT ? 127 : 126, "%s", *argv); From owner-freebsd-arch@freebsd.org Tue Nov 14 03:54:06 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEF1FCFE363 for ; Tue, 14 Nov 2017 03:54:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8574D6CE11 for ; Tue, 14 Nov 2017 03:54:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id n134so8401788itg.1 for ; Mon, 13 Nov 2017 19:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=LkTh+Ji7A/09LWhQvoD7jPDSLM6dd6wqclKhhKrmfsU=; b=It9g3P0IHdWkgnfE2+cDo0i+yqw0UPdTco3nfmw2yuwPWfVCHgWlgOkEOQZUNnhM4j MYtnkj5fQxtq4a+hIUA7S8z2B/Qw1A6W5KIz41HI7t6PdUbVqwAbQqabqN9u740WFZn5 6vShno+zjkKkLnUrb89ACjYYO5pVbWZBxdQrMWzW1zlysh9s71TJqRFALeluxMchQMft rrsFTbmubkvV/GIJ+VLSMsFjUlhs/1+v/o9mqDJigRfoq/8r/u5VO7YY5Xh3NZADqwAm ngbTuX3CQCgFP84PTk4vp6+dlMk3LE+/1C8QLAmleKgfFU5Dxi73lodCv9hYTJyC9s4i 5J2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=LkTh+Ji7A/09LWhQvoD7jPDSLM6dd6wqclKhhKrmfsU=; b=I0jNE2NMBbTe2KYQVokmH79BC/q3C9ha7Y8FAOwQUKxq05ag6XZq2NVv9ggnfRhCMu uKdV82/HTj3++QTHPohwCM1YqUjfpu6fEiZtibf+gybCjFhrul7m5d/ES97cux2ct5qx hC+8u9pG6SGG5Km6tOqgus1amUXayYQt3sYeHZrezDYL3Aeya69vh8x264PftJB/5/cg 9jPLLoUPmB8Y2KCF2Zm7h+ecggcjlfpudwuPy+M14cSfCKw2IWpCdgYGIyZjxaZApOUs iyiwWxF6wZxXsjVetDJCf1SNclV8M9U+CIyl3ef00L+Hbdob7VIlFXexeGIrRSWaw6gI bdMQ== X-Gm-Message-State: AJaThX7F5ge/xb+XhwIemicIzaEtIGbI/Id0VKheebSek6wkYrozzFCa vLyzjSIweVju3Vzo2XqocE+5S2I+pVw0KrcbbJ4L8w== X-Google-Smtp-Source: AGs4zMYoBiTrWurKMk23O8dCiSkk/eZaSJLpbBcH/ZjF3YbmMpG5B2EboEfphDzcZgutKmJksRZD3y4VK3F1MAXJv/U= X-Received: by 10.36.94.129 with SMTP id h123mr12124694itb.64.1510631645709; Mon, 13 Nov 2017 19:54:05 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.108.204 with HTTP; Mon, 13 Nov 2017 19:54:05 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:e4fb:a5e7:1b7a:fc3a] In-Reply-To: <20171114020138.GA18863@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> From: Warner Losh Date: Mon, 13 Nov 2017 20:54:05 -0700 X-Google-Sender-Auth: yVK2ZPO2N9ftgF0ePi5wJoRUz2c Message-ID: Subject: Re: small patch for numactl. Comments? To: Larry McVoy Cc: "freebsd-arch@freebsd.org" , Scott Long , Kevin Bowling , Drew Gallatin Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 03:54:06 -0000 On Mon, Nov 13, 2017 at 7:01 PM, Larry McVoy wrote: > Hi folks, some CDN people are dragging me out of retirement to work > on FreeBSD. Which I have to say is sort of fun since I started my > kernel hacking on SunOS 4.x which was a very very nice version of > BSD. But FreeBSD has mostly caught up, so it's pleasant. > > I'm wacking LMbench to be numa aware and this patch would help me make > sure that when you are a numa machine you could insist that people > run the benchmark via numactl (imma gonna blog about numa, it sucks > unless you are numa aware). > > I did some docs but I'm new to the FreeBSD man macros, would love > feedback on how to do that right. > > --- numactl.1 2017-11-13 17:51:26.243473000 -0800 > +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 > @@ -107,6 +107,15 @@ > .El > .Sh EXIT STATUS > .Ex -std > +.Sh ENVIRONMENT > +.Nm > +sets the environment variable > > +\fINUMACTL=YES\fP > .Va NUMACTL=YES The rest looks good... Warner +before running > +.Ar cmd ... > +so that programs that know that they need to be run under > +.Nm > +can check. > .Sh EXAMPLES > Create a > .Pa /bin/sh > --- numactl.c 2017-11-13 16:18:36.134359000 -0800 > +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 > @@ -231,6 +231,7 @@ > (void) set_numa_domain_cpuaffinity(cpu_domain, > CPU_WHICH_PID, -1); > > + putenv("NUMACTL=YES"); > errno = 0; > execvp(*argv, argv); > err(errno == ENOENT ? 127 : 126, "%s", *argv); > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" > From owner-freebsd-arch@freebsd.org Tue Nov 14 04:35:08 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10B3ECFF68D for ; Tue, 14 Nov 2017 04:35:08 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E70836E090 for ; Tue, 14 Nov 2017 04:35:07 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OZE00H004L3N800@mr11p00im-asmtp004.me.com> for freebsd-arch@freebsd.org; Tue, 14 Nov 2017 04:35:05 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1510634105; bh=Zxwr6mNYsIQLrNjR3Hcf5RVYshD2EMf+75yrRQi1Phk=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=Amf0Ihe2ofcGtjqh1ztZp/Xziwdv6+js2jx6a2zfvHFR917RFGExYlNti78eBA4JF g7F0DGTL725TVScKyZo9XmXUOn4/3cgk3YFqXtBBayTnFQxkZJc+1XTmwGjxgipJTg KVGCBQ7awgUC7Q0oqmxgv4s1FXCQdaPLlGXrhTDDpUD5RTnrX57ELy/D9X1cN6SepZ zeoy/YmYvJ4AIPHbJ4sdOiweElzdvv2yuRlj/rv1oKKcqQsc+Akw0bmUKScIu3IuLG EbJaT+Q8BGswbe3pCatNxOsL27pGs6fYZzTjYd7+gjf6Q6eAPbQa0OSgBkgBVsaVKE X4vg0C3lm+Xaw== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OZE00IPN4QERI00@mr11p00im-asmtp004.me.com>; Tue, 14 Nov 2017 04:35:03 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-14_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711140061 User-Agent: Microsoft-MacOutlook/f.27.0.171010 Date: Mon, 13 Nov 2017 20:35:02 -0800 Subject: Re: small patch for numactl. Comments? From: Ravi Pokala To: Larry McVoy , freebsd-arch@freebsd.org Cc: scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Message-id: Thread-topic: small patch for numactl. Comments? References: <20171114020138.GA18863@mcvoy.com> In-reply-to: <20171114020138.GA18863@mcvoy.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 04:35:08 -0000 Hi Larry, Might I suggest a small wording change? Three "that"s in the same sentence is a little much. :-) > +so that programs that know that they need to be run under > +.Nm > +can check. +so programs which know that they need to be run under +.Nm , +can check. Also, I recommend installing textproc/igor, and using it to scan the manpage for common mistakes. Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Larry McVoy Date: 2017-11-13, Monday at 18:01 To: Cc: , , Subject: small patch for numactl. Comments? Hi folks, some CDN people are dragging me out of retirement to work on FreeBSD. Which I have to say is sort of fun since I started my kernel hacking on SunOS 4.x which was a very very nice version of BSD. But FreeBSD has mostly caught up, so it's pleasant. I'm wacking LMbench to be numa aware and this patch would help me make sure that when you are a numa machine you could insist that people run the benchmark via numactl (imma gonna blog about numa, it sucks unless you are numa aware). I did some docs but I'm new to the FreeBSD man macros, would love feedback on how to do that right. --- numactl.1 2017-11-13 17:51:26.243473000 -0800 +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 @@ -107,6 +107,15 @@ .El .Sh EXIT STATUS .Ex -std +.Sh ENVIRONMENT +.Nm +sets the environment variable +\fINUMACTL=YES\fP +before running +.Ar cmd ... +so that programs that know that they need to be run under +.Nm +can check. .Sh EXAMPLES Create a .Pa /bin/sh --- numactl.c 2017-11-13 16:18:36.134359000 -0800 +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 @@ -231,6 +231,7 @@ (void) set_numa_domain_cpuaffinity(cpu_domain, CPU_WHICH_PID, -1); + putenv("NUMACTL=YES"); errno = 0; execvp(*argv, argv); err(errno == ENOENT ? 127 : 126, "%s", *argv); _______________________________________________ freebsd-arch@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" From owner-freebsd-arch@freebsd.org Tue Nov 14 04:36:55 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59EFBCFF77E for ; Tue, 14 Nov 2017 04:36:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24BA76E1AD for ; Tue, 14 Nov 2017 04:36:54 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f181.google.com with SMTP id u42so5043844ioi.9 for ; Mon, 13 Nov 2017 20:36:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=MC4fwIe84JHOzz8sm5WGmxTK2MRwPnWz1xuQiiQzWG4=; b=jvzbXlNErJqqWb2K1eVNOoNIJ2M0eEutwSm7fDvahnTyyq+8R/q9RU4CiPTdGCKR2z MVn4sKjSKNCjR56bhvNVcz9BUrvWHbiRmxb3s556AXQyVIJI7K8z+o6PHA8aAj6t6hAY zKGX3qG10/aJ0Ergl76hdCLCaR650g1Unvsp9BSqyI4QCGQtJBkZiYHkJvhC/wsnASTK OLQAUi4hZ0Qj1G9pRiG+0VRstp1K2ckyPfn8OK0m+NQkDZRVC4uvaAuQ2jGR3jWmZGsL bXdWDe0kmmI1tzto9A4DkNr8LZ0TAHwQON7e9pdu46uggt3TcDtlLvfCcd/F7sMP59QO /d1g== X-Gm-Message-State: AJaThX5ofGn9ur+UBGAQYhUBX5DNj8DMvnSqbBVJ7yHJyrm54uheqz4J 7baQc9oZz5FA7RL4+KeBCr83qajM X-Google-Smtp-Source: AGs4zMa3OjeZva2o9rAh/Yg6EqA435wlNqBvtGtnd1lE/cHMFSKW/fjjngwN78zj0M1hjfb/Q6ls+g== X-Received: by 10.107.83.12 with SMTP id h12mr12621713iob.13.1510633739216; Mon, 13 Nov 2017 20:28:59 -0800 (PST) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id r4sm4955981itg.11.2017.11.13.20.28.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2017 20:28:58 -0800 (PST) Received: by mail-it0-f45.google.com with SMTP id 72so12123039itl.5 for ; Mon, 13 Nov 2017 20:28:58 -0800 (PST) X-Received: by 10.36.228.68 with SMTP id o65mr13882784ith.128.1510633738126; Mon, 13 Nov 2017 20:28:58 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Mon, 13 Nov 2017 20:28:57 -0800 (PST) In-Reply-To: <20171114020138.GA18863@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> From: Conrad Meyer Date: Mon, 13 Nov 2017 20:28:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: small patch for numactl. Comments? To: Larry McVoy Cc: "freebsd-arch@freebsd.org" , scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 04:36:55 -0000 Hi Larry, What if instead, the benchmark checked its own NUMA parameters? If a NUMA policy is not set, the benchmark can bail out with an admonishment. Best, Conrad On Mon, Nov 13, 2017 at 6:01 PM, Larry McVoy wrote: > Hi folks, some CDN people are dragging me out of retirement to work > on FreeBSD. Which I have to say is sort of fun since I started my > kernel hacking on SunOS 4.x which was a very very nice version of > BSD. But FreeBSD has mostly caught up, so it's pleasant. > > I'm wacking LMbench to be numa aware and this patch would help me make > sure that when you are a numa machine you could insist that people > run the benchmark via numactl (imma gonna blog about numa, it sucks > unless you are numa aware). > > I did some docs but I'm new to the FreeBSD man macros, would love > feedback on how to do that right. > > --- numactl.1 2017-11-13 17:51:26.243473000 -0800 > +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 > @@ -107,6 +107,15 @@ > .El > .Sh EXIT STATUS > .Ex -std > +.Sh ENVIRONMENT > +.Nm > +sets the environment variable > +\fINUMACTL=YES\fP > +before running > +.Ar cmd ... > +so that programs that know that they need to be run under > +.Nm > +can check. > .Sh EXAMPLES > Create a > .Pa /bin/sh > --- numactl.c 2017-11-13 16:18:36.134359000 -0800 > +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 > @@ -231,6 +231,7 @@ > (void) set_numa_domain_cpuaffinity(cpu_domain, > CPU_WHICH_PID, -1); > > + putenv("NUMACTL=YES"); > errno = 0; > execvp(*argv, argv); > err(errno == ENOENT ? 127 : 126, "%s", *argv); > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" From owner-freebsd-arch@freebsd.org Tue Nov 14 14:06:56 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19520DBFC3E for ; Tue, 14 Nov 2017 14:06:56 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09C277FDD3; Tue, 14 Nov 2017 14:06:55 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: by mcvoy.com (Postfix, from userid 3546) id EC5FD35E130; Tue, 14 Nov 2017 06:06:54 -0800 (PST) Date: Tue, 14 Nov 2017 06:06:54 -0800 From: Larry McVoy To: Conrad Meyer Cc: Larry McVoy , "freebsd-arch@freebsd.org" , scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Subject: Re: small patch for numactl. Comments? Message-ID: <20171114140654.GC21209@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 14:06:56 -0000 Hi Conrad, Nice idea but pretty awkward compared to checking an env var. I'd have to #ifdef up the code for numa (the benchmark in question is portable to all the active Unix based systems and a lot of dead ones). Is it not a thing on FreeBSD to use the environment to pass state like this? --lm On Mon, Nov 13, 2017 at 08:28:57PM -0800, Conrad Meyer wrote: > Hi Larry, > > What if instead, the benchmark checked its own NUMA parameters? If a > NUMA policy is not set, the benchmark can bail out with an > admonishment. > > Best, > Conrad > > > On Mon, Nov 13, 2017 at 6:01 PM, Larry McVoy wrote: > > Hi folks, some CDN people are dragging me out of retirement to work > > on FreeBSD. Which I have to say is sort of fun since I started my > > kernel hacking on SunOS 4.x which was a very very nice version of > > BSD. But FreeBSD has mostly caught up, so it's pleasant. > > > > I'm wacking LMbench to be numa aware and this patch would help me make > > sure that when you are a numa machine you could insist that people > > run the benchmark via numactl (imma gonna blog about numa, it sucks > > unless you are numa aware). > > > > I did some docs but I'm new to the FreeBSD man macros, would love > > feedback on how to do that right. > > > > --- numactl.1 2017-11-13 17:51:26.243473000 -0800 > > +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 > > @@ -107,6 +107,15 @@ > > .El > > .Sh EXIT STATUS > > .Ex -std > > +.Sh ENVIRONMENT > > +.Nm > > +sets the environment variable > > +\fINUMACTL=YES\fP > > +before running > > +.Ar cmd ... > > +so that programs that know that they need to be run under > > +.Nm > > +can check. > > .Sh EXAMPLES > > Create a > > .Pa /bin/sh > > --- numactl.c 2017-11-13 16:18:36.134359000 -0800 > > +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 > > @@ -231,6 +231,7 @@ > > (void) set_numa_domain_cpuaffinity(cpu_domain, > > CPU_WHICH_PID, -1); > > > > + putenv("NUMACTL=YES"); > > errno = 0; > > execvp(*argv, argv); > > err(errno == ENOENT ? 127 : 126, "%s", *argv); > > _______________________________________________ > > freebsd-arch@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" -- --- Larry McVoy lm at mcvoy.com http://www.mcvoy.com/lm From owner-freebsd-arch@freebsd.org Tue Nov 14 14:08:08 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7790EDBFCB9 for ; Tue, 14 Nov 2017 14:08:08 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69CBF7FEA2 for ; Tue, 14 Nov 2017 14:08:08 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: by mcvoy.com (Postfix, from userid 3546) id CCAD735E130; Tue, 14 Nov 2017 06:08:07 -0800 (PST) Date: Tue, 14 Nov 2017 06:08:07 -0800 From: Larry McVoy To: Ravi Pokala Cc: Larry McVoy , freebsd-arch@freebsd.org, scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Subject: Re: small patch for numactl. Comments? Message-ID: <20171114140807.GD21209@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 14:08:08 -0000 Hokay, took the suggestions, new patch for you. --- numactl.1 2017-11-13 17:51:26.243473000 -0800 +++ numactl.1.lm 2017-11-14 06:03:30.564340000 -0800 @@ -107,6 +107,15 @@ .El .Sh EXIT STATUS .Ex -std +.Sh ENVIRONMENT +.Nm +sets the environment variable +.Va NUMACTL=YES +before running +.Ar cmd ... +so programs that know they need to be run under +.Nm +can check. .Sh EXAMPLES Create a .Pa /bin/sh --- numactl.c 2017-11-13 16:18:36.134359000 -0800 +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 @@ -231,6 +231,7 @@ (void) set_numa_domain_cpuaffinity(cpu_domain, CPU_WHICH_PID, -1); + putenv("NUMACTL=YES"); errno = 0; execvp(*argv, argv); err(errno == ENOENT ? 127 : 126, "%s", *argv); From owner-freebsd-arch@freebsd.org Tue Nov 14 14:42:14 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB666DC0BF3 for ; Tue, 14 Nov 2017 14:42:14 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CE2C135A for ; Tue, 14 Nov 2017 14:42:14 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: by mcvoy.com (Postfix, from userid 3546) id E8D5F35E130; Tue, 14 Nov 2017 06:42:13 -0800 (PST) Date: Tue, 14 Nov 2017 06:42:13 -0800 From: Larry McVoy To: Ravi Pokala Cc: Larry McVoy , freebsd-arch@freebsd.org, scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Subject: Re: small patch for numactl. Comments? Message-ID: <20171114144213.GA6265@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 14:42:14 -0000 So is there some reason for the igor name? Why not doc-lint or something that someone would have some chance of finding? I like the program, especially this: -e Verify that sentences start on a new line. mdoc(7) does not enforce this, it is a style issue. because that style means that if you version control your docs you get much nicer diffs. I've got a little perl script that does that for me. On Mon, Nov 13, 2017 at 08:35:02PM -0800, Ravi Pokala wrote: > Also, I recommend installing textproc/igor, and using it to scan the manpage for common mistakes. From owner-freebsd-arch@freebsd.org Tue Nov 14 15:58:08 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 063AADD49AD; Tue, 14 Nov 2017 15:58:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D75116368D; Tue, 14 Nov 2017 15:58:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id ED78510A8BE; Tue, 14 Nov 2017 10:58:06 -0500 (EST) From: John Baldwin To: freebsd-arch@freebsd.org Cc: Warner Losh , "freebsd-arch@freebsd.org" , "freebsd-embedded@freebsd.org" , Ed Maste Subject: Re: Coming move of files (src/sys/boot/fdt/dts -> src/sys/dts and then src/sys/boot -> src/stand) Date: Mon, 13 Nov 2017 16:41:10 -0800 Message-ID: <1641032.10EYgl8r7h@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 14 Nov 2017 10:58:07 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 15:58:08 -0000 On Saturday, November 11, 2017 03:50:43 PM Warner Losh wrote: > Greetings, > > The subject line says it all... > > I plan on moving src/sys/boot to src/stand since it isn't part of the > kernel (though it uses parts of the kernel, like user land uses parts of > the kernel). It's built with buildworld, and more properly belongs there, > but none of the existing top-level directories fit the bill. > > There's one exception, however. sys/boot/fdt/dts contains the DTS sources > for a bunch of embedded boards. This needs to remain in the kernel because > some kernels attach DTS files statically to the final image. I propose this > land in src/sys/dts. > > Of course, all references to the old paths will be migrated to new paths. > > I'd expect to move this before we import lua boot, and that lua would thus > wind up in src/contrib. > > Comments? \o/ -- John Baldwin From owner-freebsd-arch@freebsd.org Tue Nov 14 17:02:31 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6BC2DD7791 for ; Tue, 14 Nov 2017 17:02:31 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from pv33p00im-asmtp003.me.com (pv33p00im-asmtp003.me.com [17.142.194.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 995026600E for ; Tue, 14 Nov 2017 17:02:31 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.pv33p00im-asmtp003.me.com by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OZF00O000GX0U00@pv33p00im-asmtp003.me.com> for freebsd-arch@freebsd.org; Tue, 14 Nov 2017 16:02:25 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1510675344; bh=60NSZkM9sTCNKnsAPCOzwa1X4j8+GWxXiVBW8SYK4Qk=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=bD3oBUAGG5Bep0uRDxRATzz20y2ua0pZ87ZPte0Mz+MuaFB15HCHgbiXeuT1zEnM+ Q38mFJ6Mzz4QpyZdm5AxRdvAninh1t2OWQwaHMoyTbBWjjiz5CGiqVjUEnWYaF3une WJu4noWNepXYkfj+dbY8r97j4Y/W+9VJFm1pH9c48trjs8+O2TrYC0/41XQV0kmoFL kX+v9KvjHW8ZScQP5GIVkXa2uIMmCdSMcIlXnwcia7fEvR/rqY0RO7B1x2MCnD7eaN wqNy98b77ad4AdS47pt6Ve3/moHdKDgCuHn1PnPxe1X9cTFR+126QKKyPrfZcUvg3O neuEsUFicxBNA== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OZF00KQ00JYL700@pv33p00im-asmtp003.me.com>; Tue, 14 Nov 2017 16:02:24 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-14_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711140218 User-Agent: Microsoft-MacOutlook/f.27.0.171010 Date: Tue, 14 Nov 2017 08:02:21 -0800 Subject: Re: small patch for numactl. Comments? From: Ravi Pokala To: Larry McVoy Cc: scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com, freebsd-arch@freebsd.org Message-id: Thread-topic: small patch for numactl. Comments? References: <20171114020138.GA18863@mcvoy.com> <20171114144213.GA6265@mcvoy.com> In-reply-to: <20171114144213.GA6265@mcvoy.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 17:02:31 -0000 Probably because `igor' helps the mad scientists with doc commit-bits? :-) -Ravi (rpokala@) -----Original Message----- From: on behalf of Larry McVoy Date: 2017-11-14, Tuesday at 06:42 To: Ravi Pokala Cc: , , , Larry McVoy , Subject: Re: small patch for numactl. Comments? So is there some reason for the igor name? Why not doc-lint or something that someone would have some chance of finding? I like the program, especially this: -e Verify that sentences start on a new line. mdoc(7) does not enforce this, it is a style issue. because that style means that if you version control your docs you get much nicer diffs. I've got a little perl script that does that for me. On Mon, Nov 13, 2017 at 08:35:02PM -0800, Ravi Pokala wrote: > Also, I recommend installing textproc/igor, and using it to scan the manpage for common mistakes. _______________________________________________ freebsd-arch@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" From owner-freebsd-arch@freebsd.org Tue Nov 14 17:21:35 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 477D4DD8461 for ; Tue, 14 Nov 2017 17:21:35 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38E2C66D4B for ; Tue, 14 Nov 2017 17:21:34 +0000 (UTC) (envelope-from lm@mcvoy.com) Received: by mcvoy.com (Postfix, from userid 3546) id 42C2335E130; Tue, 14 Nov 2017 09:21:34 -0800 (PST) Date: Tue, 14 Nov 2017 09:21:34 -0800 From: Larry McVoy To: Mateusz Guzik Cc: Larry McVoy , freebsd-arch@freebsd.org, scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com Subject: Re: small patch for numactl. Comments? Message-ID: <20171114172134.GD6265@mcvoy.com> References: <20171114020138.GA18863@mcvoy.com> <20171114171032.ez6pxk3yrlczplvi@mguzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171114171032.ez6pxk3yrlczplvi@mguzik> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 17:21:35 -0000 On Tue, Nov 14, 2017 at 06:10:34PM +0100, Mateusz Guzik wrote: > > I'm wacking LMbench to be numa aware and this patch would help me make > > sure that when you are a numa machine you could insist that people > > run the benchmark via numactl (imma gonna blog about numa, it sucks > > unless you are numa aware). > > > > Well, I think the right thing to do is to query the existing policy and > complain when it turns out nothing is set. Perhaps exit by default and > add a switch to proceed anyway. As already stated, that means #ifdef-ing portable code. Not a fan of that. I believe someone already approved env var approach anyway. From owner-freebsd-arch@freebsd.org Tue Nov 14 18:07:21 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 900DADD99DC for ; Tue, 14 Nov 2017 18:07:21 +0000 (UTC) (envelope-from scottl@netflix.com) Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com [IPv6:2607:f8b0:400e:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E6DC68F03 for ; Tue, 14 Nov 2017 18:07:21 +0000 (UTC) (envelope-from scottl@netflix.com) Received: by mail-pg0-x230.google.com with SMTP id 70so3444973pgf.6 for ; Tue, 14 Nov 2017 10:07:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dBz/1vL3wwa0PgxHd0vIO8z8cLuytjC6ImMt58myxPU=; b=SohmB9RjQTQDczDukZWEud6cc+lcOkaSAiHfeD805QhnLCSCyg+PT1Ud2XrkKMdOfh qRmaBPDK3Pkb3cSe5GQbWLPYzHW6gK6nZeCGsUTrzkxVmHTucUlZo80b/tvyd6/kYltD XG9MjdejG4sqcBPyP3kss+Xpp1CURzYBPVzhAUidT9Yz5FNVLNp0/P9mWPMqhh7qi+LT F0BsSi9eRvH04qp2+SSaeIYqv8m/qqoaqH4b7X3QbMW+gPxkTsfZvYW+fora4t4XwDnf wQVB58XX7Yyv8QgneIA0q3veDyCSG8/c2p524wlMI1LL3TegViBpZjXUDbJMHdcy6vxU NG8w== X-Gm-Message-State: AJaThX5hLPNChjakiZlj99pwe7wFkRuSwLYDoty+FS8t6EBUfu/nZP+N T0gA95zbzitXSWvQsk1iOCELyQ== X-Google-Smtp-Source: AGs4zMb9higHu+pizZ7bVsXK0HjXPDrMtq4o7mIiqVvlTMRJAXCe/2l5ezrG2QZiku3BR7S9WnyfAA== X-Received: by 10.98.192.7 with SMTP id x7mr14790945pff.142.1510682840402; Tue, 14 Nov 2017 10:07:20 -0800 (PST) Received: from ?IPv6:2607:fb10:7021:1::ba51? ([2607:fb10:7021:1::ba51]) by smtp.gmail.com with ESMTPSA id h29sm42751962pfd.65.2017.11.14.10.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Nov 2017 10:07:19 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: small patch for numactl. Comments? From: Scott Long In-Reply-To: <20171114172134.GD6265@mcvoy.com> Date: Tue, 14 Nov 2017 11:07:18 -0700 Cc: Mateusz Guzik , freebsd-arch@freebsd.org, Kevin Bowling , gallatin@netflix.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <20171114020138.GA18863@mcvoy.com> <20171114171032.ez6pxk3yrlczplvi@mguzik> <20171114172134.GD6265@mcvoy.com> To: Larry McVoy X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 18:07:21 -0000 > On Nov 14, 2017, at 10:21 AM, Larry McVoy wrote: >=20 > On Tue, Nov 14, 2017 at 06:10:34PM +0100, Mateusz Guzik wrote: >>> I'm wacking LMbench to be numa aware and this patch would help me = make >>> sure that when you are a numa machine you could insist that people=20= >>> run the benchmark via numactl (imma gonna blog about numa, it sucks >>> unless you are numa aware). >>>=20 >>=20 >> Well, I think the right thing to do is to query the existing policy = and >> complain when it turns out nothing is set. Perhaps exit by default = and >> add a switch to proceed anyway. >=20 > As already stated, that means #ifdef-ing portable code. Not a fan of = that. >=20 > I believe someone already approved env var approach anyway. FWIW, communicating state via environment variables is not a common = pattern in the core FreeBSD userland tools. It=E2=80=99s a bit more common in the = contributed tools. That=E2=80=99s probably why people are wishy-washy about your proposal. = That said, there=E2=80=99s no architectural rule against what you=E2=80=99re = proposing, it=E2=80=99s useful, and it=E2=80=99s not invasive and needing long discussion. Scott From owner-freebsd-arch@freebsd.org Wed Nov 15 13:35:09 2017 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 541BBDDD1B3 for ; Wed, 15 Nov 2017 13:35:09 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 26C4B6B59D; Wed, 15 Nov 2017 13:35:08 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (124-148-77-206.dyn.iinet.net.au [124.148.77.206]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id vAFDYwtB090808 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 15 Nov 2017 05:35:03 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: small patch for numactl. Comments? To: Larry McVoy , Conrad Meyer Cc: scottl@netflix.com, kbowling@llnw.com, gallatin@netflix.com, "freebsd-arch@freebsd.org" References: <20171114020138.GA18863@mcvoy.com> <20171114140654.GC21209@mcvoy.com> From: Julian Elischer Message-ID: Date: Wed, 15 Nov 2017 21:34:53 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171114140654.GC21209@mcvoy.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Nov 2017 13:35:09 -0000 On 14/11/17 10:06 pm, Larry McVoy wrote: > Hi Conrad, > > Nice idea but pretty awkward compared to checking an env var. > I'd have to #ifdef up the code for numa (the benchmark in question > is portable to all the active Unix based systems and a lot of dead > ones). > > Is it not a thing on FreeBSD to use the environment to pass state > like this? it's not unheard of, but it's not common. I can't think of other examples off the top of my head except for sshd, sudo and other login type things. there is no reason NOT to other than the fact that you are the only user of the feature.. You could make it more useful by putting information more useful than "YES" there.. It also is only useful if you use numactl to do the work. Any other methods of setting Numa related settings would not have it. ..  Also environments get cleared in many situations. It's  workable solution for you. I'd go with it for now.. > > --lm > > On Mon, Nov 13, 2017 at 08:28:57PM -0800, Conrad Meyer wrote: >> Hi Larry, >> >> What if instead, the benchmark checked its own NUMA parameters? If a >> NUMA policy is not set, the benchmark can bail out with an >> admonishment. >> >> Best, >> Conrad >> >> >> On Mon, Nov 13, 2017 at 6:01 PM, Larry McVoy wrote: >>> Hi folks, some CDN people are dragging me out of retirement to work >>> on FreeBSD. Which I have to say is sort of fun since I started my >>> kernel hacking on SunOS 4.x which was a very very nice version of >>> BSD. But FreeBSD has mostly caught up, so it's pleasant. >>> >>> I'm wacking LMbench to be numa aware and this patch would help me make >>> sure that when you are a numa machine you could insist that people >>> run the benchmark via numactl (imma gonna blog about numa, it sucks >>> unless you are numa aware). >>> >>> I did some docs but I'm new to the FreeBSD man macros, would love >>> feedback on how to do that right. >>> >>> --- numactl.1 2017-11-13 17:51:26.243473000 -0800 >>> +++ numactl.1.lm 2017-11-13 17:51:20.494596000 -0800 >>> @@ -107,6 +107,15 @@ >>> .El >>> .Sh EXIT STATUS >>> .Ex -std >>> +.Sh ENVIRONMENT >>> +.Nm >>> +sets the environment variable >>> +\fINUMACTL=YES\fP >>> +before running >>> +.Ar cmd ... >>> +so that programs that know that they need to be run under >>> +.Nm >>> +can check. >>> .Sh EXAMPLES >>> Create a >>> .Pa /bin/sh >>> --- numactl.c 2017-11-13 16:18:36.134359000 -0800 >>> +++ numactl.c.lm 2017-11-13 16:18:28.530953000 -0800 >>> @@ -231,6 +231,7 @@ >>> (void) set_numa_domain_cpuaffinity(cpu_domain, >>> CPU_WHICH_PID, -1); >>> >>> + putenv("NUMACTL=YES"); >>> errno = 0; >>> execvp(*argv, argv); >>> err(errno == ENOENT ? 127 : 126, "%s", *argv); >>> _______________________________________________ >>> freebsd-arch@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-arch >>> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"