From owner-freebsd-arch@freebsd.org Sat Jan 25 18:58:29 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9568A1F7B61 for ; Sat, 25 Jan 2020 18:58:29 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 484ldx2Pg0z3xgd for ; Sat, 25 Jan 2020 18:58:29 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mailman.nyi.freebsd.org (Postfix) id 5284B1F7B60; Sat, 25 Jan 2020 18:58:29 +0000 (UTC) Delivered-To: arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5247B1F7B5C for ; Sat, 25 Jan 2020 18:58:29 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 484ldw2D73z3xgc for ; Sat, 25 Jan 2020 18:58:27 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pg1-x52d.google.com with SMTP id x7so2931669pgl.11 for ; Sat, 25 Jan 2020 10:58:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:user-agent:mime-version; bh=sGsjLE7tFbos/EsU3Wcx/c1Tx+8Ew09ZdkAE9C1qhTk=; b=s6abrpNLrWtt7Z2FsTTg+tq3FEgwEmpdC4QEgF1Qtrvq7yvKS346NDQm4htBOD9cCL F0J9DD7OyiXZFe+MJUtabike/ENMXiDY3uSny7W6E/p9J802LXO6KGtl66UtrDin9vRo I1rj9ekFwsIEkpGe0Gic5BfRQu5o0Xb9UUwfSoDcuCNIzUBwzD5j2uxyA82L6Lmn3UNO mMfU5nugGhu24dZM0hylLZDTx1yEgJKUU9HncEHRnD1IcuYgH+/MhO64lGgUZA+mFmYB wMK0DcesLZLG6xwM623xBYKbtcpyJJHYfoEWQBfEZUk5QWhH0L15aKewHt7AD4mHn9kj njAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version; bh=sGsjLE7tFbos/EsU3Wcx/c1Tx+8Ew09ZdkAE9C1qhTk=; b=i8UYv7ePlI7ejr4rT5pc0HriLEUpGWCQTNAFoecX2vyAHhaQ4FGaw5W8k1PSfuyYIn 31lS5trMrlwSYVWvcCGuNRUSxjiz/cMAzEOfDknxSF2AK++83MmHpe7uPR0IXjwffCyJ GJsak8nEg67SYfUFSGAQ/9bvPf/+CHzk96UxVNhAfGY7AD4EgGJGnuTKyrt4+zmYbtAw y84iRKRBNowGvgSF/JozNzVugNAPM6nzxLp0995NX59Dab9rhPaIn2y6PwtxLmkUfcbb z97orajINiAfLX9oRZ5tOGnXE7OFSUv20Q1E/7D2EGK4GB2EMXnZ9PSGPYl69EzXUivG bzZg== X-Gm-Message-State: APjAAAWNm1zkSHat8ahQYcnZwswAX8fSNA9ynE5BEWxUDJbjFmuagotG ElpcEMKgZIOpFujmxZapMk5jR7fZKQU= X-Google-Smtp-Source: APXvYqzu1A08Um5RxSCfUUkzZs2BiEK7KDCufbvfEcz1BXEoEEjKttHMEm90Yi5YPyAOl6Fm2cKrOw== X-Received: by 2002:aa7:8a8e:: with SMTP id a14mr9049418pfc.217.1579978705890; Sat, 25 Jan 2020 10:58:25 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id l37sm881184pjb.15.2020.01.25.10.58.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jan 2020 10:58:25 -0800 (PST) Date: Sat, 25 Jan 2020 08:58:23 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: arch@freebsd.org Subject: New Safe Memory Reclamation feature in UMA Message-ID: User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Rspamd-Queue-Id: 484ldw2D73z3xgc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=s6abrpNL; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::52d) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-4.33 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[arch@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[jroberson.net]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[d.2.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-2.53)[ip: (-8.76), ipnet: 2607:f8b0::/32(-2.05), asn: 15169(-1.79), country: US(-0.05)] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2020 18:58:29 -0000 Hello Folks, I want to make the larger community aware of a substantial feature coming to UMA soon. The review is at https://reviews.freebsd.org/D22586 along with some perf results. SMR is a technique that allows for various types of lockless synchronization by eliminating use-after-free hazards. This is in the same family as RCU/QSBR/EPOCH/Parsec. There is quite a lot of material available on the uses of these algorithms. Most of these algorithms suffer from holding on to freed memory for a relatively long period of time and reclaiming it when it's cache-cold. This also creates quite a lot of resource starvation edge cases. This is evident by the amount of code in RCU on linux intended to work around these issues. These algorithms are generally best with a small write/free workload and a very heavy read workload. For the virtual memory system I needed something that could sustain relatively rapid frees. I have ended up with a scheme that integrates with the allocator and uses a novel epoch/version tracking mechanism. The pair of these gives me 3x faster performance with 1/20th the memory overhead of our existing epoch implementation in my obviously contrived perf test. I do not want to imply that if we replaced the network epoch with uma smr the network stack would go 3x faster. I do think there may be benefits there especially for things with high turnover like pcbs. I do not yet have support for sleepable sections so there is a lot of technical space between here and there. There is a lot of information in the review and comments in the code. I will be validating on weaker memory ordering architectures. I need to write a man page. I would like to find a snappy name to avoid confusion with other algorithms. If anyone has suggestions I am open to it. Thanks, Jeff