Ignore:
Timestamp:
Aug 14, 2020, 5:32:32 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d2b5d2d
Parents:
a5bc72e
Message:

Added support for partial submit strategy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    ra5bc72e r1095ccd  
    514514        }
    515515
     516        #define PARTIAL_SUBMIT 32
    516517        static unsigned __collect_submitions( struct __io_data & ring ) {
    517518                /* paranoid */ verify( ring.submit_q.ready != 0p );
     
    521522                __u32 tail = *ring.submit_q.tail;
    522523                const __u32 mask = *ring.submit_q.mask;
     524                #if defined(PARTIAL_SUBMIT)
     525                        #if defined(LEADER_LOCK)
     526                                #error PARTIAL_SUBMIT and LEADER_LOCK cannot co-exist
     527                        #endif
     528                        const __u32 cnt = ring.submit_q.ready_cnt > PARTIAL_SUBMIT ? PARTIAL_SUBMIT : ring.submit_q.ready_cnt;
     529                        const __u32 offset = ring.submit_q.prev_ready;
     530                        ring.submit_q.prev_ready += cnt;
     531                #else
     532                        const __u32 cnt = ring.submit_q.ready_cnt;
     533                        const __u32 offset = 0;
     534                #endif
    523535
    524536                // Go through the list of ready submissions
    525                 for( i; ring.submit_q.ready_cnt ) {
     537                for( c; cnt ) {
     538                        __u32 i = (offset + c) % ring.submit_q.ready_cnt;
     539
    526540                        // replace any submission with the sentinel, to consume it.
    527541                        __u32 idx = __atomic_exchange_n( &ring.submit_q.ready[i], -1ul32, __ATOMIC_RELAXED);
Note: See TracChangeset for help on using the changeset viewer.