You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/06/11 12:56:49 UTC

[GitHub] [activemq-artemis-native] JeffMoyer commented on a change in pull request #7: ARTEMIS-2800 Fixes around Linux Kernel Bug

JeffMoyer commented on a change in pull request #7:
URL: https://github.com/apache/activemq-artemis-native/pull/7#discussion_r438761134



##########
File path: src/main/c/org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.c
##########
@@ -129,9 +129,24 @@ static int user_io_getevents(io_context_t aio_ctx, unsigned int max,
                     struct io_event *events)
 {
    long i = 0;
-   unsigned head;
+   unsigned head, tail, avail;
    struct aio_ring *ring = to_aio_ring(aio_ctx);
 
+   // continue until the available values are <= max
+   do {
+       head = ring->head;
+       mem_barrier();
+       tail = ring->tail;
+
+       if (tail >= head)
+           avail = tail - head;
+       else
+           avail = ring->nr - (head - tail);
+
+       if (avail <= max)
+           break;
+    } while (1);

Review comment:
       Nothing should be changing the head pointer, so all you need to do is check for updates to tail.  I think what I sent you was about as simple as you can make that loop.  I also think this code change deserves a comment explaining the kernel bug that it is working around.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org