From owner-freebsd-hackers@freebsd.org Wed Aug 22 07:09:52 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B122108F5EC for ; Wed, 22 Aug 2018 07:09:52 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E067B863FB for ; Wed, 22 Aug 2018 07:09:51 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id A7DFC1211E for ; Wed, 22 Aug 2018 07:09:51 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-io0-f172.google.com with SMTP id q4-v6so696666iob.8 for ; Wed, 22 Aug 2018 00:09:51 -0700 (PDT) X-Gm-Message-State: AOUpUlFpihwV9awx1Oqt2bejv/ppikSUpfZwXImWRB9afNwG8Oce9niU 1fIYIDfxgWY4F2z2jn+2xnz1dr/Q2JbxIjnso00= X-Google-Smtp-Source: AA+uWPy8TY9Ry9AOiXaZVldL4JJ9uqpg/okqHV+3WwuNvr+hKZSE90M9j/+vOfg/nZw7rJlvamFhgudMWoNxM9AFh/Y= X-Received: by 2002:a6b:ed11:: with SMTP id n17-v6mr19952603iog.132.1534921791172; Wed, 22 Aug 2018 00:09:51 -0700 (PDT) MIME-Version: 1.0 References: <15e3f080-2f82-a243-80e9-f0a916445828@embedded-brains.de> <26445c95-17c5-1a05-d290-0741d91b7721@embedded-brains.de> In-Reply-To: <26445c95-17c5-1a05-d290-0741d91b7721@embedded-brains.de> From: Matthew Macy Date: Wed, 22 Aug 2018 00:09:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: epoch(9) background information? To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 07:09:52 -0000 > > > Yes. Very. It is generally not permitted to hold a mutex across > > epoch_wait() that's why there's the special flag EPOCH_LOCKED. If you > > have a very limited number of threads, you might want to have each > > thread have its own record registered with the epoch. Then you > > wouldn't need the CPU pinning. The pinning is just away of providing a > > limited number of records to an unbounded number of threads. > > Thanks for the prompt answer. > > Do I need a record per thread and per epoch? Could I use only one (maybe > dependent on the nest level?) record per thread? > > A record can only be registered with one epoch. And yes you can have just one single global epoch. However, then the epoch_wait_preempt time or time until the gc task is run is determined be the longest epoch section globally. It may help to look at the ck_epoch man pages and the implementation in ck https://www.mankier.com/3/ck_epoch_register https://github.com/concurrencykit/ck/blob/master/src/ck_epoch.c https://github.com/concurrencykit/ck/blob/master/include/ck_epoch.h > -- > >