From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 025723858401 for ; Tue, 21 May 2024 07:30:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 025723858401 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 025723858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; cv=none; b=dhv/lf4x7enh3Z5NPUm5wT59muGDV0E4J0sf/QyaA9jHl7ANkgB04sl4wNKb4W4jXGAJXcL7e2TklvgZxy/cYOELpq1gqhM0+U35Wi/ZhZViKKJ8Lhj7Vg3T2NW6zoaenCc1ltIIKv7CaJB7l445byFV0YIhJ4SXclQ01/VufYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716276659; c=relaxed/simple; bh=FCQFr4K15TgjINtx+i9vAmEtQZ0u4rpm5R+GwsdxzTQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=E+QzVla652CgQJjaEqMhDYVAK5UaHeYZQCzeVDps+1XKwfPFSbhipLQmFzqva60gDEF3Rh7yJ6foNRgm6VtnwWaROi5Kl/cXsyi/VbnjaIiTXFZsBI7EcIXrW9kXuctDB7LrNOPaJKBzepFzPlULPIlDRTJiIZ+goz2TYgZp8No= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-34d7b0dac54so1787521f8f.0 for ; Tue, 21 May 2024 00:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1716276656; x=1716881456; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNjb+/yqFBEgZZDHNYoUMuKHP17dJfSqQXptAtdoRxA=; b=CdXl0sUXQCkpXMTropsCY3vJ/6wny3O0ro6eBHcnEqUSCtUQawfY5itJfCXPA4Tsg7 MH3uFlkeMkCrtYN90cktNWwMcsjxV/JdZHjdbmU9KrI3TuOdgT1peuBUsSEsJO3mTaiQ Gdr17dCvhE1H82rwf3N1J2kcXkXHHCiiIqHlnRIZMIIEtUOjM6ZV5bBD95xH5hLvGE3a d5bEB2YOlpumLLV0i7jLO6zpP0F1q7vMSw0hMgiQoNaUanzi+RDjelV13YPg+h6bmHx1 evpFtp2pmlrbI0obnjh/cmYb+zlVpDjRhpZe5em3TxnK/v2GLG/QaSWB7NE2oi0PXgDt Lmeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716276656; x=1716881456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZNjb+/yqFBEgZZDHNYoUMuKHP17dJfSqQXptAtdoRxA=; b=eyKir9H33SRzTfEzeIZLEAGqVz8ItMAuMPyeU24bShWly9bkRp/Uwl/ekdEj7mIs+C /AiTZqkuNzUmP78HycyGOQHVDTyaOdFUBKeATYMhsMXhRex5tFprklBLV9xCEKSpGrEJ Ktxjdc4xx8LOmD/K1wXFhGbbG8IBxCD7+Dcl9+btGmQspyeoKnch7aAKTiKAc6T1O4ub B8N/jyiNy8+uaIlpLgjrc+kANm3RqIP6v3gH/Cg0XBNs14r1YDhj2wrgHUPxuAuFuOJR OfOmwLxnPKF8gV785uPP4UszePT3cY5zRdota7x1MBMmAiNBMOM1LKDwblmyw9iF9FNS BO+w== X-Gm-Message-State: AOJu0YxaMZuEsklIK4HluuTArQhyYNy/7UIukpnm+BRtU1oucHdnevZF Q6rQHoN0K6WtDo4oSIZQShVUdUNhSbT91Dzb5ROOfVHA5Kf5/t8J7FWw8jPr3PiOh7+WYE1HY7Y = X-Google-Smtp-Source: AGHT+IGmGDMYSbt2CM4w2hUcR54qEe8w5DGGIVw8THDvsktgR/zklTe46CzHrxTT5KMCRoYcQeFXIg== X-Received: by 2002:a05:6000:1943:b0:34d:ce05:29ef with SMTP id ffacd0b85a97d-354b8e0945amr6947426f8f.17.1716276656080; Tue, 21 May 2024 00:30:56 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9292sm453333645e9.37.2024.05.21.00.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:30:55 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 10/31] ada: Remove some explicit yields in tasking run-time Date: Tue, 21 May 2024 09:30:13 +0200 Message-ID: <20240521073035.314024-10-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521073035.314024-1-poulhies@adacore.com> References: <20240521073035.314024-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Ronan Desplanques This patch removes three occurrences where tasking run-time subprograms yielded control shortly before conditional calls to Sleep, in order to avoid these calls more often. It was intended as an optimization on systems where calls to Sleep are costly and in particular VMS. A problem was that two of the yields contained data races that were reported by thread sanitizing tools on some platforms, and that's the motivation for removing them. gcc/ada/ * libgnarl/s-taenca.adb (Wait_For_Completion): Remove call to Yield. * libgnarl/s-tasren.adb (Timed_Selective_Wait, Wait_For_Call): Remove calls to Yield. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnarl/s-taenca.adb | 12 ------------ gcc/ada/libgnarl/s-tasren.adb | 24 ------------------------ 2 files changed, 36 deletions(-) diff --git a/gcc/ada/libgnarl/s-taenca.adb b/gcc/ada/libgnarl/s-taenca.adb index cd9c53b19fe..1dc8ec518bd 100644 --- a/gcc/ada/libgnarl/s-taenca.adb +++ b/gcc/ada/libgnarl/s-taenca.adb @@ -410,18 +410,6 @@ package body System.Tasking.Entry_Calls is Self_Id.Common.State := Entry_Caller_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the caller - -- a chance of getting ready immediately, using Unlock & Yield. - -- See similar action in Wait_For_Call & Timed_Selective_Wait. - - STPO.Unlock (Self_Id); - - if Entry_Call.State < Done then - STPO.Yield; - end if; - - STPO.Write_Lock (Self_Id); - loop Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call); diff --git a/gcc/ada/libgnarl/s-tasren.adb b/gcc/ada/libgnarl/s-tasren.adb index d65b9f011b0..6face7ef8d4 100644 --- a/gcc/ada/libgnarl/s-tasren.adb +++ b/gcc/ada/libgnarl/s-tasren.adb @@ -1317,18 +1317,6 @@ package body System.Tasking.Rendezvous is Self_Id.Common.State := Acceptor_Delay_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the - -- caller a chance of getting ready immediately, using Unlock - -- Yield. See similar action in Wait_For_Completion/Wait_For_Call. - - Unlock (Self_Id); - - if Self_Id.Open_Accepts /= null then - Yield; - end if; - - Write_Lock (Self_Id); - -- Check if this task has been aborted while the lock was released if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then @@ -1510,18 +1498,6 @@ package body System.Tasking.Rendezvous is begin Self_Id.Common.State := Acceptor_Sleep; - -- Try to remove calls to Sleep in the loop below by letting the caller - -- a chance of getting ready immediately, using Unlock & Yield. - -- See similar action in Wait_For_Completion & Timed_Selective_Wait. - - Unlock (Self_Id); - - if Self_Id.Open_Accepts /= null then - Yield; - end if; - - Write_Lock (Self_Id); - -- Check if this task has been aborted while the lock was released if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then -- 2.43.2