From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92986CD5BD0 for ; Wed, 27 May 2026 12:14:29 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 214453C9EBC for ; Wed, 27 May 2026 14:14:28 +0200 (CEST) Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 4ABA53C0354 for ; Wed, 27 May 2026 14:14:09 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 9AE4D10009DB for ; Wed, 27 May 2026 14:14:08 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F423366FC5; Wed, 27 May 2026 12:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1779884048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yLrzpAZEpZ92Jt8BK2KdNg7RiBYOpKzTLyP/LRYHRq8=; b=FCBJlXNSx4GvyrIhyYSog45MBfQgs5KNTWigwpbctUSRAx6DykSkp+XyJ6oocXpODesghR Io57yQNtfWjNyFt7KacJ9u2LRqXrTXKTTTYaomvKpBilHbqB6xLCd9o+Z+Kt7/CVQMyQob 4DHl+AK6rQNTYaV8Qt0e28rwl8fUPQw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1779884048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yLrzpAZEpZ92Jt8BK2KdNg7RiBYOpKzTLyP/LRYHRq8=; b=qSxgrHtPCnLJez2R+wudNlvYDfcakfyyMScueiqsINhEJn2KV7+pkp0QBDOLbOxYNU3hjk +v3v7UrmszqSRMBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1779884048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yLrzpAZEpZ92Jt8BK2KdNg7RiBYOpKzTLyP/LRYHRq8=; b=FCBJlXNSx4GvyrIhyYSog45MBfQgs5KNTWigwpbctUSRAx6DykSkp+XyJ6oocXpODesghR Io57yQNtfWjNyFt7KacJ9u2LRqXrTXKTTTYaomvKpBilHbqB6xLCd9o+Z+Kt7/CVQMyQob 4DHl+AK6rQNTYaV8Qt0e28rwl8fUPQw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1779884048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yLrzpAZEpZ92Jt8BK2KdNg7RiBYOpKzTLyP/LRYHRq8=; b=qSxgrHtPCnLJez2R+wudNlvYDfcakfyyMScueiqsINhEJn2KV7+pkp0QBDOLbOxYNU3hjk +v3v7UrmszqSRMBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E5F7B5A811; Wed, 27 May 2026 12:14:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EJ81Nw/gFmohWQAAD6G6ig (envelope-from ); Wed, 27 May 2026 12:14:07 +0000 Date: Wed, 27 May 2026 14:13:53 +0200 From: Cyril Hrubis To: Petr Vorel Message-ID: References: <20260527103756.448843-1-chrubis@suse.cz> <20260527112911.GA194670@pevik> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260527112911.GA194670@pevik> X-Spamd-Result: default: False [-8.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,imap1.dmz-prg2.suse.org:helo] X-Virus-Scanned: clamav-milter 1.0.9 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: Re: [LTP] [PATCH] syscalls/madvise06: Fix sporadic not enough RAM TCONFs X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ltp@lists.linux.it Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" Hi! > > On systems with <= 2GB RAM the test produced sporadic TCONFs. That is > > because even if the test setup does sync() and drops caches the system > > starts fauting in pages immediatelly after caches were dropped. It may > > easily happen that system may fault in a few hundred of MBs of memory > > betwen the write to drop_caches and the time sysinfo() syscall returns. > > > The correct fix is to use the MemAvailable metric from /proc/meminfo > > that includes both free memory and caches and is more realistic estimate > > of how much memory can be consumed by a test. We even have helper > > functions in the test library so we simply make use of them. > > Thanks for an investigation! > Reviewed-by: Petr Vorel > > ... > > - sysinfo(&sys_buf_start); > > - if (sys_buf_start.freeram < 2 * CHUNK_SZ) { > > - tst_brk(TCONF, "System RAM is too small (%li bytes needed)", > > - 2 * CHUNK_SZ); > > + long long avail_mem = tst_available_mem(); > > + long long avail_swap = tst_available_swap(); > > + long long chunk_kb = 2 * CHUNK_SZ / 1024; > > + > > + if (avail_mem < chunk_kb) { > > + tst_brk(TCONF, "System RAM is too small %llikB (%llikB needed)", > > + avail_mem, chunk_kb); > > nit: I'd print also the current (not big enough) values (I know that the old code). Huh? That's what the test does after my changes, we print both avail_mem and chunk_kb after the change. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp