From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752169AbdA3Dk4 (ORCPT ); Sun, 29 Jan 2017 22:40:56 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36490 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751922AbdA3DkB (ORCPT ); Sun, 29 Jan 2017 22:40:01 -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, dan.j.williams@intel.com Subject: [DEBUG 21/21] selftests/powerpc: Add a script to perform random VMA migrations Date: Mon, 30 Jan 2017 09:06:02 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170130033602.12275-1-khandual@linux.vnet.ibm.com> References: <20170130033602.12275-1-khandual@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17013003-0008-0000-0000-00000105029A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17013003-0009-0000-0000-000008F7DDBF Message-Id: <20170130033602.12275-22-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-30_02:,, 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-1612050000 definitions=main-1701300038 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 | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 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..3ded302 --- /dev/null +++ b/tools/testing/selftests/vm/cdm_migration.sh @@ -0,0 +1,77 @@ +#!/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 -- 2.9.3