[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVMB4YyyEDph5CsVPRLFe4ZncxVrarxV7-VT2wC=pbPTZQ@mail.gmail.com>
Date: Tue, 11 Mar 2014 23:34:21 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Alexander Gordeev <agordeev@...hat.com>
Cc: Kent Overstreet <kmo@...erainc.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Jens Axboe <axboe@...nel.dk>,
"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
Subject: Re: [PATCH RESEND 1/3] percpu_ida: Fix data race on cpus_have_tags cpumask
On Tue, Mar 11, 2014 at 10:03 PM, Alexander Gordeev <agordeev@...hat.com> wrote:
>>
>> In theory, it still might cause percpu_ida_alloc(TASK_RUNNING) failed,
>> looks it isn't a big deal for the case.
>>
>> But I am wondering why cpumask_set_cpu() isn't called with
>> holding lock inside percpu_ida_free()? Looks 'nr_free == 1'
>> shouldn't have happened frequently.
>
> Because bouncing on the lock is more expensive than occasionally putting
> a thread into sleep.
I mean the below block can be put inside the previous lock:
if (nr_free == 1)
cpumask_set_cpu()
As I mentioned, 'nr_free == 1' doesn't happen frequently, so
it won't be big deal, will it?
Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists