[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/mem_sharing: don't lock parent during fork reset

  • To: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 17 Sep 2021 09:26:10 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YFBhz6nwdzlrstTFpNbiXuqgmlHYUueogQifd2M0ax4=; b=N84SdCnduDCJMc3jNqm1JNxgQMjxMJgA+rsSY0ftDPn9u5aKccicrf2XcZHk6oi7inyXGdsGln2pnVqHXfkX6GUvi/sykMxKU83bkHXCt/SiLu3uKNx62qK+sBwCkRxZZ6PcMFiaPADAjWoKG7dC+tHORPxQCZtZ3giXY+Suv4Bul0gZNA/Y477hm3ww939srAT/j2ZugPXmY3o71+QElsQkNmh1vUMA+N/mM34XYJOBA/Cvr/cWirelIgSiUbNaeiib1ut4OY7j5Ubf0zIMfOhLQUT670uWe9lBN2Zt64zQJZ1LapLmHqVeUpsQolks0x9S7aazoRTMy6swBy8Jig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EekxNJxJ9SQX8GMNt9/fa/1NHAioyG88UI2hbI4Gxeq8dZlIJvaCj4ifxzKjUTkLTFl09itZyODrABngWdFlzyY5pGOoBXiK5CmEfHnPJObrT0Zeg6eF33H6QU7VA/5zEU0sVF6fblBwERxa9oupz2lPNhK0j9nKEz89zYQsoTrZII0IEkjd6fnV2yLpxTjHNR7MX51uKt4XKWr4TrM1s4xdf24RYXgLya9y8wQEQbfHV4giPBlIYbJpM9aAvu4NIjuBcT1qZ/2WjOUwVTQN7y3eGDjpGKpEog9y/Xj9bT1DxmIn+vMW9/QKFGxlsmclnngChYjSvDDrvW9YhbMzhA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 17 Sep 2021 07:26:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.09.2021 17:04, Tamas K Lengyel wrote:
> During fork reset operation the parent domain doesn't need to be gathered 
> using
> rcu_lock_live_remote_domain_by_id as the fork reset doesn't modify anything on
> the parent. The parent is also guaranteed to be paused while forks are active.
> This patch reduces lock contention when performing resets in parallel.

I'm a little in trouble following you here: RCU locks aren't really
locks in that sense, so "lock contention" seems misleading to me. I
can see that rcu_lock_domain_by_id()'s loop is extra overhead.

Furthermore - does the parent being paused really mean the parent
can't go away behind the back of the fork reset? In fork() I see

    if ( rc && rc != -ERESTART )
        cd->parent = NULL;

i.e. the ref gets dropped before the parent pointer gets cleared. If
the parent having a reference kept was indeed properly guaranteed, I
agree the code change itself is fine.

(The sequence looks correct at the other put_domain() site [dealing
with the success case of fork(), when the reference gets retained]
in domain_relinquish_resources().)




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.