From owner-freebsd-arch@FreeBSD.ORG Fri Feb 20 22:37:21 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD9C5E27; Fri, 20 Feb 2015 22:37:21 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E30D66A; Fri, 20 Feb 2015 22:37:20 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id t1KMbB4V029402; Fri, 20 Feb 2015 16:37:13 -0600 Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by pp2.rice.edu with ESMTP id 1snuunrjyd-1; Fri, 20 Feb 2015 16:37:13 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from [10.87.76.252] (unknown [10.87.76.252]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 3BACC460129; Fri, 20 Feb 2015 16:37:13 -0600 (CST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: getting NUMA into the tree (userland most interesting for me) From: Alan Cox In-Reply-To: <2069208.rjIe3PXOHb@ralph.baldwin.cx> Date: Fri, 20 Feb 2015 16:37:12 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <968C1AD7-D806-4E69-87E4-AB88A4C5AA70@rice.edu> References: <20150219041012.GJ1953@funkthat.com> <2069208.rjIe3PXOHb@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=1.11015641124368e-11 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.248919945447816 suspectscore=2 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.248919945447816 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.248919945447816 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502200211 Cc: Adrian Chadd , "K. Macy" , Alan Cox , John-Mark Gurney , Konstantin Belousov , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2015 22:37:21 -0000 On Feb 20, 2015, at 2:14 PM, John Baldwin wrote: > On Friday, February 20, 2015 12:17:09 AM K. Macy wrote: >>>>> Yes, I think we have a fair bit to do in the kernel before we are = in a >>>>> position to export anything truly useful to userland = unfortunately. The >>>>> last time I talked with Jeff about projects/numa (after the first = draft >>>>> of the wiki page) I came away with the impression that there might = be >>>>> some things we can pull out of that branch, but that it isn't = suitable >>>>> for merging upstream directly. Jeff noted that he and Alan had = gone >>>>> through several iterations of this already (I believe at least 3 >>>>> completely different policy designs) all of which had their own = issues. >>>>>=20 >>>>> Outside of the VM I think that we can keep the APIs somewhat = stable by >>>>> having this opaque policy cookie to pass around that we can = redefine >>>>> the guts of later. However, various parts of the VM all have to = handle >>>>> whatever the policy defines, and while the vm_phys bits and >>>>> contigmalloc() might be kind of obvious to implement, higher level = VM >>>>> layers like kmem() and malloc() are more complicated. One thing = that >>>>> is in projects/numa is changes for UMA that we can hopefully reuse = much >>>>> of, but I don't recall how much (if any) of kmem/malloc is in = there.=20 >>>>> Also, while vm_phys is one of the first things to do, I know that = Alan >>>>> and Jeff have pending patches to remove the cache queue (since it = is >>>>> far less useful than it seems) which simplify vm_phys making it = easier >>>>> to implement NUMA policies there, so I'm hoping we can get that in >>>>> sooner before having to start tearing up the VM too much. This is = why >>>>> the stuff I currently have is targeted non-VM bits like interrupts = as >>>>> getting that correct is lower-hanging fruit that might provide = some >>>>> gains regardless. Even once vm_phys is done I think the first = thing to >>>>> tackle next is contigmalloc to facilitate static bus_dma = allocations >>>>> (descriptor rings and such) being local to a device. >>>>=20 >>>> Contigmalloc improvements and cache queue removal are in the >>>> phabricator queue now. They are also prerequisites for per-cpu free >>>> page caches which are a huge scalability improvement for some >>>> workloads such as Netflix's. >>>>=20 >>>> There is still a fair amount of scalability work (including = Jeffr's >>>> per-domain pagedaemon work) that really needs to happens before we = can >>>> seriously think about a general user-level NUMA interface. >>>=20 >>> Is there anything wrong with maybe bringing over the basic low level >>> allocator changes from projects/numa so the basics are there? >>=20 >> I think they're probably predicated on the work that is being >> shepherded in now. Even if not, it would require someone to shepherd >> it in and the corresponding spare cycles from alc to review / revise = / >> repeat - which seem to be in short supply. >=20 > Can you add entries for these to the wiki page with links to the phab = reviews? =20 > I know there is an entry for the page cache queue removal already, but = you=20 > could add one for contigmalloc right next to it. >=20 Essentially, the =93Remove the =91cache=92 page queue=94 task has a = number of significant subtasks that aren=92t listed, and the = contigmalloc() rewrite is the biggest of them. Specifically, the = current contigmalloc(M_WAITOK) implementation exploits the existence of = the =91cache=92 page queue, and to eliminate that dependence requires = the M_WAITOK case to work very differently.