From nobody Tue Feb 10 06:08:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1594983274; cv=none; d=zohomail.com; s=zohoarc; b=Dp5b8d3DFDhhEz7AWMzmxV9oaXGCfG/q83rgbdVQ95Lu7wQLf4SNtfrVttllX58cw4X14hbQnUtZsEMa2ZLn+jjSJS0UjhcDHVYA1s48qWUS/TFYxmm59vuoCSxy/U7COo9x5bRWwWfWRWAIAYvPihgCKqFFvWAf1q4uvbS+Idw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594983274; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KVJaVP/ZQ17vhjW05uiIXG4G85am9cMHX0FIzvUa6Gc=; b=nBInFx7zoU/PEQ4nrhCylQ+y9oKV5tusn7EqjjnGAJUL4WwxcPLtyuOH/OEJ2uMjsmiRVpKxEVcD1YNZGVXTn1/8gKlXRee2QQ5V7l2WSSenetG4i7Ne3XQ5fGRGJxOc68/XJ/mV9+bH0Qv3ksKlmEStgsNK8Kr1Oku2/xObigY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594983274423136.46906829040745; Fri, 17 Jul 2020 03:54:34 -0700 (PDT) Received: from localhost ([::1]:46314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwO0f-0000KW-7W for importer@patchew.org; Fri, 17 Jul 2020 06:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwNy6-0004ct-OZ for qemu-devel@nongnu.org; Fri, 17 Jul 2020 06:51:54 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jwNy3-0003sB-BS for qemu-devel@nongnu.org; Fri, 17 Jul 2020 06:51:54 -0400 Received: by mail-wr1-x442.google.com with SMTP id z2so10539549wrp.2 for ; Fri, 17 Jul 2020 03:51:48 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z16sm13486743wrr.35.2020.07.17.03.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 03:51:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 121B31FF91; Fri, 17 Jul 2020 11:51:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KVJaVP/ZQ17vhjW05uiIXG4G85am9cMHX0FIzvUa6Gc=; b=TIsgKk+7hM/o3q1rcPINasp0D3y3YY7fmPqK+eUpDIjnY8yEsLNi6ZHjTVaScsxRab gSBtqT5xLA/2ClouJBexXk9NnHrmYBFCaxX6uCmkuCtSrNN9KFn7OY8X18/GnL6DxviQ mGXYxL1+URFB45O5Uwy/IBK0LGoGjGWcfZzu7P7Dl1Y0f2M+qyZvSwnj4mRsYi5ntk2U sUdOq4m8oAbYtvuYB3T6vDvh5KVR4PR6LtWYHA1RKmevmlx3h4KP7eFMfKUKReRUh/OX brnfUUVD6k/IJKidftnVoc93zDoxWB2alwQInixtDBJthDlz4xUW7LgpGrtk3AmBgyXM azew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KVJaVP/ZQ17vhjW05uiIXG4G85am9cMHX0FIzvUa6Gc=; b=TORdoFQVLJRPc++k6hbrs7pEon/XbQ7VS50hfGkMnos8qjv5YlUozFVMBLeXlZw8Qf pjfwnaXxAp0hJsXyRdQcTunux1swUuV7hmc5H1RDNQHQu8awAH3VYZlnxGpwiDkfasj7 j2djw0nU6/fH41f0gqvqzLH602j57exTKXaq+vyOd5h5YEBg1HqcxSyI4VPjMtFwtHEK YIZByfS8OR99KptUs3OMyF7DbV/+qPzpNHUg2LZs5MavAWaFpBLQq1D5sWt1AxbJ7COT +Xoedyj2mZgiGkyjhFDrptBEOLujvmo6hJYmeaVrGbY9hnCvYj9F8Fk+fOVjzSs0vBDW YMpg== X-Gm-Message-State: AOAM53268o031PSWuYv/WeUAdqIeVqJMubP4av8BCoXhZSjO6JMHRhq2 zYaFw58DlH73LwAYmgI/UTKWgA== X-Google-Smtp-Source: ABdhPJwzBflR/rTnGfoL9M2+KTqfN9wYlFd/SsM6RgDTvjAqKdYh+NRhzl3o22Fnmdp2M+TT9ZyJPw== X-Received: by 2002:adf:f504:: with SMTP id q4mr9479420wro.163.1594983107713; Fri, 17 Jul 2020 03:51:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/5] accel/tcg: better handle memory constrained systems Date: Fri, 17 Jul 2020 11:51:39 +0100 Message-Id: <20200717105139.25293-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200717105139.25293-1-alex.bennee@linaro.org> References: <20200717105139.25293-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, berrange@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, Christian Ehrhardt , cota@braap.org, Paolo Bonzini , aurelien@aurel32.net, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It turns out there are some 64 bit systems that have relatively low amounts of physical memory available to them (typically CI system). Even with swapping available a 1GB translation buffer that fills up can put the machine under increased memory pressure. Detect these low memory situations and reduce tb_size appropriately. Fixes: 600e17b261 Signed-off-by: Alex Benn=C3=A9e Cc: BALATON Zoltan Cc: Christian Ehrhardt --- accel/tcg/translate-all.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 2afa46bd2b1..2ff0ba6d19b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -976,7 +976,12 @@ static inline size_t size_code_gen_buffer(size_t tb_si= ze) { /* Size the buffer. */ if (tb_size =3D=3D 0) { - tb_size =3D DEFAULT_CODE_GEN_BUFFER_SIZE; + size_t phys_mem =3D qemu_get_host_physmem(); + if (phys_mem > 0 && phys_mem < (2 * DEFAULT_CODE_GEN_BUFFER_SIZE))= { + tb_size =3D phys_mem / 4; + } else { + tb_size =3D DEFAULT_CODE_GEN_BUFFER_SIZE; + } } if (tb_size < MIN_CODE_GEN_BUFFER_SIZE) { tb_size =3D MIN_CODE_GEN_BUFFER_SIZE; --=20 2.20.1