[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96909a80-516c-07c9-eaa4-adc42114848a@oracle.com>
Date: Mon, 17 Sep 2018 16:00:19 -0400
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Dongli Zhang <dongli.zhang@...cle.com>,
xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Cc: jgross@...e.com, wei.liu2@...rix.com, konrad.wilk@...cle.com,
srinivas.eeda@...cle.com, paul.durrant@...rix.com,
roger.pau@...rix.com
Subject: Re: [Xen-devel] [PATCH 2/6] xenbus: implement the xenwatch
multithreading framework
On 9/16/18 9:48 PM, Dongli Zhang wrote:
> Hi Boris,
>
> On 09/17/2018 05:20 AM, Boris Ostrovsky wrote:
>>
>> On 9/14/18 3:34 AM, Dongli Zhang wrote:
>>> +
>>> +/* Running in the context of default xenwatch kthread. */
>>> +void mtwatch_create_domain(domid_t domid)
>>> +{
>>> + struct mtwatch_domain *domain;
>>> +
>>> + if (!domid) {
>>> + pr_err("Default xenwatch thread is for dom0\n");
>>> + return;
>>> + }
>>> +
>>> + spin_lock(&mtwatch_info->domain_lock);
>>> +
>>> + domain = mtwatch_find_domain(domid);
>>> + if (domain) {
>>> + atomic_inc(&domain->refcnt);
>>> + spin_unlock(&mtwatch_info->domain_lock);
>>> + return;
>>> + }
>>> +
>>> + domain = kzalloc(sizeof(*domain), GFP_ATOMIC);
>> Is there a reason (besides this being done under spinlock) for using GFP_ATOMIC?
>> If domain_lock is the only reason I'd probably drop the lock and do GFP_KERNEL.
> spin_lock is the reason.
>
> Would you like to switch to a mutex here?
I'd use mutex.
-boris
Powered by blists - more mailing lists