From patchwork Thu Apr 18 07:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Gao X-Patchwork-Id: 1924831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.linux.it header.i=@lists.linux.it header.a=rsa-sha256 header.s=picard header.b=dUDPqarG; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=WC95tsCH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VKpty5DPSz1yPv for ; Thu, 18 Apr 2024 17:14:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1713424485; h=to : date : message-id : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : content-type : content-transfer-encoding : sender : from; bh=5UiMNgtRNqeaLA+8MYdTV25UfmbOA4glV/UTXNhwwRs=; b=dUDPqarGlqLo2h3MoTR+4k31aPIlutdGp4d2YtrGMQLAP6b5dhs0ZQAHjnlRAxFrXZU0K mUZEBkaJZsSTr4h5kIbQMmxgSQOTQ9cfe/C3QH4fhMAzlVr2DwLyVxgtcNXtBM35jBvx4Gv baUuokHSh2hPg6D/UQcSFTtfewS1tc8= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4E2903CFBB6 for ; Thu, 18 Apr 2024 09:14:45 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 4B5C43CF513 for ; Thu, 18 Apr 2024 09:14:41 +0200 (CEST) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 2915414098BF for ; Thu, 18 Apr 2024 09:14:41 +0200 (CEST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2db2f6cb312so9739861fa.2 for ; Thu, 18 Apr 2024 00:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1713424480; x=1714029280; darn=lists.linux.it; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NPrQOwK5zOqtDh37beYLP5A1peau2b0baTuIP0+LCiY=; b=WC95tsCHtxDYkd6d21jVvq8tcs4KrteFuf7XyYgkfYRZNsCbNty14aCUpXXV5HEUow CEq7dVWffGwWA30E0nHpGV2nYgOqGNDCt6AC3qoB/xmE7XgoW3h3rZOKWqwRBl3Lv1gj YTzmq7AVmO8RNlySyOzrI9Quj84xwehuIZYTl2hDjwDpmk6FLK+ZYPiOucZfY96vz4+n vvTMuYjMr29c9wMYQGyyXh2m7C7f1rWepgG1THcS/Dtb8HttwEm9xy5+mpHGeOVaRdrV HqhNQHGqGaOyPz8EmV3IyVMeG3c304sXfjgafSxJUPRGRfkvw81ZRPVOBMWR+BpCNO8H nUvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713424480; x=1714029280; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NPrQOwK5zOqtDh37beYLP5A1peau2b0baTuIP0+LCiY=; b=apzCHEDC5boyeH2KRak6BaxT53k7ryrf/cP3gU31Ie1RWhfKr+MjRv3V3YLv1dQeeu 1yHajRengc/OwYbcrnWFKDaVqzNRswAeLOGX86eDu+xljG8LlTSJJvcCvMoFBa1gXLYt PQTseVNu1poHmOaJTrpUrmRnwgkhqtzHeUiEy9uQSsGxGjDlQzhkAthjjpYrI0fMY4ne S2vlnh9Z/AV7+neMKH5JNYVffUrInPx9H7cvZwjCm7Rg3xCJBCzwRhB9jzMX2rkuqpOH 0f2LrkNVBc2MFSUgggt3jCGDz0bI8VTPcWNfKS3mwyoBOtOq0NnX4uj56n6BphBIc3og sy5g== X-Gm-Message-State: AOJu0YwZFyQ0wcspJVxvE18U5JiusnBLq2K9IdET9KGt3odLcj58wAk+ YzpkYHnSu7mbeh5DjwuQJH47eDk03pl3WOUVACTzLWV0fnUReM/TRZjkLg30Dqjo3s+1PMkd/To = X-Google-Smtp-Source: AGHT+IE9BwXMB5UoFV3wEWe4oiecesTdcNnQqtphbMLoOqn0l5/Zoyq87mz5+6FwNqzAKi7/X0mvBg== X-Received: by 2002:a2e:330b:0:b0:2d8:3ccc:60e8 with SMTP id d11-20020a2e330b000000b002d83ccc60e8mr1103967ljc.48.1713424479650; Thu, 18 Apr 2024 00:14:39 -0700 (PDT) Received: from localhost ([223.72.87.223]) by smtp.gmail.com with ESMTPSA id f6-20020a635546000000b005f41aeec262sm754924pgm.44.2024.04.18.00.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 00:14:39 -0700 (PDT) To: ltp@lists.linux.it Date: Thu, 18 Apr 2024 03:14:22 -0400 Message-Id: <20240418071422.10221-1-wegao@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v1] swapping01.c: Add sleeps in the loop that dirties the memory 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: , X-Patchwork-Original-From: Wei Gao via ltp From: Wei Gao Reply-To: Wei Gao Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" In our test env this case failed sporadically, we suspect swapout speed not fast enough in some situation. Detail info please check following comments; https://bugzilla.suse.com/show_bug.cgi?id=1217850#c34 Signed-off-by: Wei Gao Acked-by: Vlastimil Babka --- testcases/kernel/mem/swapping/swapping01.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c index a0030a75f..338881c8e 100644 --- a/testcases/kernel/mem/swapping/swapping01.c +++ b/testcases/kernel/mem/swapping/swapping01.c @@ -47,6 +47,7 @@ #define COE_DELTA 1 /* will try to alloc 1.3 * phy_mem */ #define COE_SLIGHT_OVER 0.3 +#define MEM_SIZE 1024 * 1024 static void init_meminfo(void); static void do_alloc(int allow_raise); @@ -101,6 +102,13 @@ static void init_meminfo(void) swap_free_init, mem_over_max); } +static void memset_blocks(char *ptr, int mem_count, int sleep_time_ms) { + for (int i = 0; i < mem_count / 1024; i++) { + memset(ptr + (i * MEM_SIZE), 1, MEM_SIZE); + usleep(sleep_time_ms * 1000); + } +} + static void do_alloc(int allow_raise) { long mem_count; @@ -115,7 +123,7 @@ static void do_alloc(int allow_raise) if (allow_raise == 1) tst_res(TINFO, "try to allocate: %ld MB", mem_count / 1024); s = SAFE_MALLOC(mem_count * 1024); - memset(s, 1, mem_count * 1024); + memset_blocks(s, mem_count, 10); if ((allow_raise == 1) && (raise(SIGSTOP) == -1)) { tst_res(TINFO, "memory allocated: %ld MB", mem_count / 1024);