From owner-svn-src-vendor@freebsd.org Thu May 17 20:57:31 2018 Return-Path: Delivered-To: svn-src-vendor@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 2DBFAEE0392; Thu, 17 May 2018 20:57:31 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C57FE75D1A; Thu, 17 May 2018 20:57:30 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A27646A22; Thu, 17 May 2018 20:57:30 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4HKvU1Y063258; Thu, 17 May 2018 20:57:30 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4HKvUW0063256; Thu, 17 May 2018 20:57:30 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201805172057.w4HKvUW0063256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Thu, 17 May 2018 20:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r333762 - in vendor-sys/ck/dist: include src X-SVN-Group: vendor-sys X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: in vendor-sys/ck/dist: include src X-SVN-Commit-Revision: 333762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2018 20:57:31 -0000 Author: cognet Date: Thu May 17 20:57:30 2018 New Revision: 333762 URL: https://svnweb.freebsd.org/changeset/base/333762 Log: Import CK as of commit deca119d14bfffd440770eb67cbdbeaf7b57eb7b This brings us ck_epoch_deferred, which is used by the new facility epoch(9). Modified: vendor-sys/ck/dist/include/ck_epoch.h vendor-sys/ck/dist/src/ck_epoch.c Modified: vendor-sys/ck/dist/include/ck_epoch.h ============================================================================== --- vendor-sys/ck/dist/include/ck_epoch.h Thu May 17 19:57:07 2018 (r333761) +++ vendor-sys/ck/dist/include/ck_epoch.h Thu May 17 20:57:30 2018 (r333762) @@ -266,6 +266,7 @@ void ck_epoch_register(ck_epoch_t *, ck_epoch_record_t void ck_epoch_unregister(ck_epoch_record_t *); bool ck_epoch_poll(ck_epoch_record_t *); +bool ck_epoch_poll_deferred(struct ck_epoch_record *record, ck_stack_t *deferred); void ck_epoch_synchronize(ck_epoch_record_t *); void ck_epoch_synchronize_wait(ck_epoch_t *, ck_epoch_wait_cb_t *, void *); void ck_epoch_barrier(ck_epoch_record_t *); Modified: vendor-sys/ck/dist/src/ck_epoch.c ============================================================================== --- vendor-sys/ck/dist/src/ck_epoch.c Thu May 17 19:57:07 2018 (r333761) +++ vendor-sys/ck/dist/src/ck_epoch.c Thu May 17 20:57:30 2018 (r333762) @@ -349,7 +349,7 @@ ck_epoch_scan(struct ck_epoch *global, } static void -ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e) +ck_epoch_dispatch(struct ck_epoch_record *record, unsigned int e, ck_stack_t *deferred) { unsigned int epoch = e & (CK_EPOCH_LENGTH - 1); ck_stack_entry_t *head, *next, *cursor; @@ -362,7 +362,10 @@ ck_epoch_dispatch(struct ck_epoch_record *record, unsi ck_epoch_entry_container(cursor); next = CK_STACK_NEXT(cursor); - entry->function(entry); + if (deferred != NULL) + ck_stack_push_spnc(deferred, &entry->stack_entry); + else + entry->function(entry); i++; } @@ -390,7 +393,7 @@ ck_epoch_reclaim(struct ck_epoch_record *record) unsigned int epoch; for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++) - ck_epoch_dispatch(record, epoch); + ck_epoch_dispatch(record, epoch, NULL); return; } @@ -551,7 +554,7 @@ ck_epoch_barrier_wait(struct ck_epoch_record *record, * is far from ideal too. */ bool -ck_epoch_poll(struct ck_epoch_record *record) +ck_epoch_poll_deferred(struct ck_epoch_record *record, ck_stack_t *deferred) { bool active; unsigned int epoch; @@ -572,7 +575,7 @@ ck_epoch_poll(struct ck_epoch_record *record) if (active == false) { record->epoch = epoch; for (epoch = 0; epoch < CK_EPOCH_LENGTH; epoch++) - ck_epoch_dispatch(record, epoch); + ck_epoch_dispatch(record, epoch, deferred); return true; } @@ -580,6 +583,13 @@ ck_epoch_poll(struct ck_epoch_record *record) /* If an active thread exists, rely on epoch observation. */ (void)ck_pr_cas_uint(&global->epoch, epoch, epoch + 1); - ck_epoch_dispatch(record, epoch + 1); + ck_epoch_dispatch(record, epoch + 1, deferred); return true; +} + +bool +ck_epoch_poll(struct ck_epoch_record *record) +{ + + return ck_epoch_poll_deferred(record, NULL); }