Merge tag 'trace-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux...
[linux-2.6-microblaze.git] / kernel / trace / ring_buffer.c
index 7887d61..13aaf5e 100644 (file)
@@ -734,9 +734,14 @@ static __always_inline bool full_hit(struct trace_buffer *buffer, int cpu, int f
        if (!nr_pages || !full)
                return true;
 
-       dirty = ring_buffer_nr_dirty_pages(buffer, cpu);
+       /*
+        * Add one as dirty will never equal nr_pages, as the sub-buffer
+        * that the writer is on is not counted as dirty.
+        * This is needed if "buffer_percent" is set to 100.
+        */
+       dirty = ring_buffer_nr_dirty_pages(buffer, cpu) + 1;
 
-       return (dirty * 100) > (full * nr_pages);
+       return (dirty * 100) >= (full * nr_pages);
 }
 
 /*
@@ -797,7 +802,8 @@ void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu)
        /* make sure the waiters see the new index */
        smp_wmb();
 
-       rb_wake_up_waiters(&rbwork->work);
+       /* This can be called in any context */
+       irq_work_queue(&rbwork->work);
 }
 
 /**