From patchwork Mon May 29 06:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 1786941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fm7F7ewn; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QV4tF5KWnz20Q9 for ; Mon, 29 May 2023 16:11:49 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 27DAB3CCFCB for ; Mon, 29 May 2023 08:11:45 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 260813CA128 for ; Mon, 29 May 2023 08:11:43 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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-3.smtp.seeweb.it (Postfix) with ESMTPS id BFD9E1A002EE for ; Mon, 29 May 2023 08:11:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685340700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pWHRNIcG52E1kCBWP3VJEpQYJrQVuIOIzA/DMIF07Tg=; b=fm7F7ewnq8m1Gfq7GlKdT1ghG9Zq6ta4n3fO1Xohb/VciPQmJULVEFQ/wL7rUU7ycWASKi 15caJg2CFxssQR1eFLm4Ca3kYkyZftijzwdnaiys93fJWC1prgcF2GAbwPxbsVLUpofhja CtVRJK33fFaU906h/O9ILp5EdXDDGuo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-lgoY_ZfONFe9we5w8UdnBw-1; Mon, 29 May 2023 02:11:38 -0400 X-MC-Unique: lgoY_ZfONFe9we5w8UdnBw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1477185A78E for ; Mon, 29 May 2023 06:11:38 +0000 (UTC) Received: from liwang-workstation.lab.eng.nay.redhat.com (unknown [10.66.145.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B05173543C for ; Mon, 29 May 2023 06:11:37 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Mon, 29 May 2023 14:11:34 +0800 Message-Id: <20230529061135.24261-1-liwang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Virus-Scanned: clamav-milter 1.0.1 at in-3.smtp.seeweb.it X-Virus-Status: Clean 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, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 1/2] hugemmap32: release mem caches and prepare for hugepage 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" As Martin pointed that mem caches count as available, we'd better release them for huge page use. Signed-off-by: Li Wang --- testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c index 36a426a09..76b790a95 100644 --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c @@ -64,6 +64,7 @@ static void setup(void) SAFE_CLOSEDIR(dir); + SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3"); if (tst_available_mem() < (long long)hpage_size) { g_hpage_path[0] = '\0'; tst_brk(TCONF, "No enough memory for gigantic hugepage reservation"); From patchwork Mon May 29 06:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 1786942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QsZ/VI0u; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QV4tQ35tpz20Pc for ; Mon, 29 May 2023 16:11:58 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3B22E3CCFF1 for ; Mon, 29 May 2023 08:11:56 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2B0003CA128 for ; Mon, 29 May 2023 08:11:44 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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-2.smtp.seeweb.it (Postfix) with ESMTPS id 85E4E60012C for ; Mon, 29 May 2023 08:11:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685340701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wjDs22wlgZk73vAcXclxtNMYkJOlcOHq87mWURS06hk=; b=QsZ/VI0uzYGODWtex6ujrAHq3jb5es3erGkUNxBIZE36QCzvWa6yg3T6iCyk8KWG1dYmnD zovlOOVEr6aQTBjoISR7cxo9LaMmNFbbfXTFH9BvKTHXCM6t6gZIIIaEqJxmnzpjAOGedx IoS1vrHi5IBY+zEfOJst01P7BIeqEzM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-6sOHW1adNP-2IZWONXoaQw-1; Mon, 29 May 2023 02:11:40 -0400 X-MC-Unique: 6sOHW1adNP-2IZWONXoaQw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3408385A5BB for ; Mon, 29 May 2023 06:11:40 +0000 (UTC) Received: from liwang-workstation.lab.eng.nay.redhat.com (unknown [10.66.145.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 425E63543C for ; Mon, 29 May 2023 06:11:38 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Mon, 29 May 2023 14:11:35 +0800 Message-Id: <20230529061135.24261-2-liwang@redhat.com> In-Reply-To: <20230529061135.24261-1-liwang@redhat.com> References: <20230529061135.24261-1-liwang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Virus-Scanned: clamav-milter 1.0.1 at in-2.smtp.seeweb.it X-Virus-Status: Clean 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, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 2/2] hugetlb: compacting memory to reduce fragmental pages 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Kernel memory compaction is a process that helps to reduce fragmentation and optimize memory allocation by compacting memory pages. `echo 1 > /proc/sys/vm/compact_memory` When 1 is written to the file, all zones are compacted such that free memory is available in contiguous blocks where possible. This can be important for example in the allocation of huge pages although processes will also directly compact memory as required. As this introduced since v2.6.35, we could safely use it via SAFE_FILE_PRINT() in LTP lib: commit 76ab0f530e4a01d4dc20cdc1d5e87753c579dc18 Author: Mel Gorman Date: Mon May 24 14:32:28 2010 -0700 mm: compaction: add /proc trigger for memory compaction Signed-off-by: Li Wang --- lib/tst_hugepage.c | 1 + testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/tst_hugepage.c b/lib/tst_hugepage.c index 728a8c3ec..d2e70a955 100644 --- a/lib/tst_hugepage.c +++ b/lib/tst_hugepage.c @@ -47,6 +47,7 @@ unsigned long tst_reserve_hugepages(struct tst_hugepage *hp) } SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3"); + SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1"); if (hp->policy == TST_NEEDS) { tst_hugepages += SAFE_READ_MEMINFO("HugePages_Total:"); goto set_hugepages; diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c index 76b790a95..d27e5b8b2 100644 --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c @@ -65,6 +65,8 @@ static void setup(void) SAFE_CLOSEDIR(dir); SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3"); + SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1"); + if (tst_available_mem() < (long long)hpage_size) { g_hpage_path[0] = '\0'; tst_brk(TCONF, "No enough memory for gigantic hugepage reservation");