[lkml]   [2009]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 3/4] kthreads: rework kthread_stop()
    "Paul E. McKenney" <> writes:

    > ACCESS_ONCE() suffices in many cases, but if the pointer being accessed
    > points to a structure that might recently have been initialized, then
    > rcu_dereference() will be required on Alpha. Though perhaps the
    > discussion below removes the need entirely, but cannot say that I fully
    > understand this part of the kernel.

    Thanks. I had overlooked the addition of ACCESS_ONCE() into our set of
    tricks. I thought Oleg was referring to a hypothetical construct.

    Currently Oleg's implementation is fine because of an explicit
    memory barrier and two dereferences of the pointer. It just isn't
    especially clear.

    ACCESS_ONCE would help.


    I wonder if it would be better/clearer to define to_kthread as:

    static struct kthread *to_kthread(struct task_struct *tsk)
    void *stack = task_stack_page(tsk);
    return (struct kthread *)(stack + kthread_offset);


    And to measure kthread_offset the first time kthread() was
    called. I would love to have a fixed compile time offset but
    I don't know how to measure it at compile time reliably.

    Oleg what do you think. It would remove the test and be simple and
    obviously correct.


     \ /
      Last update: 2009-02-04 06:13    [W:0.024 / U:16.880 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site