[lkml]   [2009]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] virtio: Fix scheduling while atomic in virtio_balloon stats
    On Fri, 11 Dec 2009 09:05:15 am Adam Litke wrote:
    > [PATCH] virtio: Fix scheduling while atomic in virtio_balloon stats
    > This is a fix for my earlier patch: "virtio: Add memory statistics reporting to
    > the balloon driver (V4)".
    > I discovered that all_vm_events() can sleep and therefore stats collection
    > cannot be done in interrupt context. One solution is to handle the interrupt
    > by noting that stats need to be collected and waking the existing vballoon
    > kthread which will complete the work via stats_handle_request(). Rusty, is
    > this a saner way of doing business?

    I think so.

    > There is one issue that I would like a broader opinion on. In stats_request, I
    > update vb->need_stats_update and then wake up the kthread. The kthread uses
    > vb->need_stats_update as a condition variable. Do I need a memory barrier
    > between the update and wake_up to ensure that my kthread sees the correct
    > value? My testing suggests that it is not needed but I would like some
    > confirmation from the experts.


    * It may be assumed that this function implies a write memory barrier before
    * changing the task state if and only if any tasks are woken up.

    > +static void stats_handle_request(struct virtio_balloon *vb)
    > +{
    > + struct virtqueue *vq;
    > + struct scatterlist sg;
    > + vb->need_stats_update = 0;
    > update_balloon_stats(vb);

    And this works without a barrier because they can't make another request
    before we finish with this one.


     \ /
      Last update: 2009-12-14 05:29    [W:0.020 / U:1.076 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site