lkml.org 
[lkml]   [2023]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED
    On Sat, 9 Sept 2023 at 13:16, Ankur Arora <ankur.a.arora@oracle.com> wrote:
    >
    > > + if (WARN_ON(resched_allowed()))
    > > + return;
    >
    > And, maybe something like this to guard against __this_cpu_read()
    > etc:
    >
    > +++ b/lib/smp_processor_id.c
    > @@ -13,6 +13,9 @@ unsigned int check_preemption_disabled(const char *what1, const char *what2)
    > {
    > int this_cpu = raw_smp_processor_id();
    >
    > + if (unlikely(resched_allowed()))
    > + goto out_error;

    Again, both of those checks are WRONG.

    They'll error out even in exceptions / interrupts, when we have a
    preempt count already from the exception itself.

    So testing "resched_allowed()" that only tests the TIF_RESCHED_ALLOW
    bit is wrong, wrong, wrong.

    These situations aren't errors if we already had a preemption count
    for other reasons. Only trying to disable preemption when in process
    context (while TIF_RESCHED_ALLOW) is a problem. Your patch is missing
    the check for "are we in a process context" part.

    Linus

    \
     
     \ /
      Last update: 2023-09-09 23:18    [W:4.234 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site