From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 8958D5A0271 for ; Mon, 5 Feb 2024 06:14:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707110057; bh=5MSrSyY/RmarVl+AnOW8Mjvb4F5mpI8FGUjS4XRe9JQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LVgEn1zvH/CIwuOsuoe8L9gEHeqffKoAIEJWVuYr/d2+K//a6ZKd2asovaUCzTk4M I2X4otFMcysqitXbHbWt0wqBpMaw+Eup5G0ytiHScooNEAWnrgKkZ5YtVVKo+nfVA5 zx2lpD0SkjP/hKm5klKfE3DVT0PnVJNmxOK41Lq3WWc9kooT6Y3S/Mxp1X6N5GYxHr zE8GpK9ZL9YlWx6LfSwKfJJznc2CDlGwJaPEleTzppsSyU7NUYTWKCRxLTV2nlpfRS 1yw819B2DefLsczj60CKslWzqjedozfCk4KL2DBPeYdMlQ7EwGV+Aj3NmeMS3jt6sQ tS3qbw8XkEKmA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TSvgY47rPz4wxZ; Mon, 5 Feb 2024 16:14:17 +1100 (AEDT) Date: Mon, 5 Feb 2024 15:16:57 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2] log: setlogmask(0) can actually result in a system call, don't use it Message-ID: References: <20240202230601.2574107-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SvoexnJVVawDo4P/" Content-Disposition: inline In-Reply-To: <20240202230601.2574107-1-sbrivio@redhat.com> Message-ID-Hash: RKHK5MFWXAVP6H7WG6DHOTRD326H33JH X-Message-ID-Hash: RKHK5MFWXAVP6H7WG6DHOTRD326H33JH X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --SvoexnJVVawDo4P/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 03, 2024 at 12:06:01AM +0100, Stefano Brivio wrote: > Before commit 32d07f5e59f2 ("passt, pasta: Completely avoid dynamic > memory allocation"), we didn't store the current log mask in a > variable, and we fetched it using setlogmask(0) wherever needed. >=20 > But after that commit, we can use our log_mask copy instead. And we > should: with recent glibc versions, setlogmask(0) actually results in > a system call, which causes a substantial overhead with high transfer > rates: we use setlogmask(0) even to decide we don't want to print > debug messages. >=20 > Now that we rely on log_mask in early stages, before setlogmask() is > called, we need to initialise that variable to the special LOG_EMERG > mask value right away: define LOG_EARLY to make this clearer, and, > while at it, group conditions in vlogmsg() into something more terse. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --SvoexnJVVawDo4P/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXAYTUACgkQzQJF27ox 2GdOZA/7B6PwU/FN6BtZB0Mu5w4rZWdZodN+QD9hA2VF6KRVWvCcH60NJZSa/0L9 2sSO97raRH5WUVpIXN6+eppaJVl4W0ge+4vc8ozNuzDOHQ66xOfOCtfGGiPwBAnU YDLVVwMw5i7rWwlBT6NyvWIXZhTMGFJw3DxjpO0ebxMRWbzn6X1jpj/0aVNvhWji UrPdHaym2KgfasPFiKmVyfvdJcw+REuLM/PJLc4wHx2kwRgmZBvu0zfvRQtx7nwH Tu0j3hv6WedzVLXv8TM/oLvouvdLvn3m9YeBgVfeTN2Qauc9b8Js2HoNTD9EVTcJ 4BRP3MCKTsTIH4OlMmHTsxJijdzZVTZT4fQqS6EVGiIbjAbQLxuI0krsHq0GAx7V oNN+/zwxyq15a+qqV9pS7TR8g22L1a5qChmvq1PGk1YlNq+96wWbLFstFuDFS0RF 54jYSYg9HK97+gBDA7CmxK1AK7LcQYzzKgnm6V9xZenDzD8ICDurhZGQeXakSK9F kTIWkAv2tQJ4A+qfvRjqayr5xP3pvMxTFfhf78zzLSUlPhKJYjtsWLbyh+7dtpFX w0UpofIL1fDEKL4aPfnFuE0hhkr05W5h/RX+KDmNeJsbkEn0PbPcBZfUhWrwA1VP wYCGxqprnqUc71XvjCRxpor/uUmOhj5uO1bC2rw0xcGnN9XPcaE= =axkl -----END PGP SIGNATURE----- --SvoexnJVVawDo4P/--