From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756104AbcKVOUo (ORCPT ); Tue, 22 Nov 2016 09:20:44 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46135 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756076AbcKVOUc (ORCPT ); Tue, 22 Nov 2016 09:20:32 -0500 From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: mhocko@suse.com, vbabka@suse.cz, mgorman@suse.de, minchan@kernel.org, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, srikar@linux.vnet.ibm.com, haren@linux.vnet.ibm.com, jglisse@redhat.com, dave.hansen@intel.com Subject: [DEBUG 12/12] test: Add a script to perform random VMA migrations across nodes Date: Tue, 22 Nov 2016 19:49:48 +0530 X-Mailer: git-send-email 2.1.0 In-Reply-To: <1479824388-30446-1-git-send-email-khandual@linux.vnet.ibm.com> References: <1479824388-30446-1-git-send-email-khandual@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112214-0008-0000-0000-000000E66D5A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112214-0009-0000-0000-0000088D8A3F Message-Id: <1479824388-30446-13-git-send-email-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-22_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220255 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a test script which creates a workload (e.g ebizzy) and go through it's VMAs (/proc/pid/maps) and initiate migration to random nodes which can be either system memory node or coherent memory node. Signed-off-by: Anshuman Khandual --- tools/testing/selftests/vm/cdm_migration.sh | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 tools/testing/selftests/vm/cdm_migration.sh diff --git a/tools/testing/selftests/vm/cdm_migration.sh b/tools/testing/selftests/vm/cdm_migration.sh new file mode 100755 index 0000000..fab11ed --- /dev/null +++ b/tools/testing/selftests/vm/cdm_migration.sh @@ -0,0 +1,76 @@ +#!/usr/bin/bash +# +# Should work with any workoad and workload commandline. +# But for now ebizzy should be installed. Please run it +# as root. +# +# Copyright (C) Anshuman Khandual 2016, IBM Corporation +# +# Licensed under GPL V2 + +# Unload, build and reload modules +if [ "$1" = "reload" ] +then + rmmod coherent_memory_demo + rmmod coherent_hotplug_demo + cd ../../../../ + make -s -j 64 modules + insmod drivers/char/coherent_hotplug_demo.ko + insmod drivers/char/coherent_memory_demo.ko + cd - +fi + +# Workload +workload=ebizzy +work_cmd="ebizzy -T -z -m -t 128 -n 100000 -s 32768 -S 10000" + +pkill $workload +$work_cmd & + +# File +if [ -e input_file.txt ] +then + rm input_file.txt +fi + +# Inputs +pid=`pidof ebizzy` +cp /proc/$pid/maps input_file.txt +if [ ! -e input_file.txt ] +then + echo "Input file was not created" + exit +fi +input=input_file.txt + +# Migrations +dmesg -C +while read line +do + addr_start=$(echo $line | cut -d '-' -f1) + addr_end=$(echo $line | cut -d '-' -f2 | cut -d ' ' -f1) + node=`expr $RANDOM % 5` + + echo $pid,0x$addr_start,0x$addr_end,$node > /sys/kernel/debug/coherent_debug +done < "$input" + +# Analyze dmesg output +passed=`dmesg | grep "migration_passed" | wc -l` +failed=`dmesg | grep "migration_failed" | wc -l` +queuef=`dmesg | grep "queue_pages_range_failed" | wc -l` +empty=`dmesg | grep "list_empty" | wc -l` +missing=`dmesg | grep "vma_missing" | wc -l` + +# Stats +echo passed $passed +echo failed $failed +echo queuef $queuef +echo empty $empty +echo missing $missing + +# Cleanup +rm input_file.txt +if pgrep -x $workload > /dev/null +then + pkill $workload +fi -- 1.8.3.1