From patchwork Tue Mar 20 13:02:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kholmanskikh X-Patchwork-Id: 888211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="CNBQyyz9"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 405CkN3BvKz9s16 for ; Wed, 21 Mar 2018 00:01:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 921323E78DE for ; Tue, 20 Mar 2018 14:01:45 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 5AD913E77C8 for ; Tue, 20 Mar 2018 14:01:40 +0100 (CET) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 266F6602045 for ; Tue, 20 Mar 2018 14:01:38 +0100 (CET) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2KCxKCZ006143 for ; Tue, 20 Mar 2018 13:01:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=SLmM4SxcZenQaxcRXOvc9MiMSpGethCiw/HBmN8x0nE=; b=CNBQyyz92tUDtnNaai5s8QHRFVPUOFXmY3wI/rzNnYo9g6LFjoJshimBjFxFt2EQwJ4n 1WCxdPP0HrZSAbMFNQhzK3+PrBx1iLThYa9laQZOJ61LvErNNdioFUxph4hfZmYSQZGX kluIYRCAha/dv3x9Zo4vpIhGL9oaY+oY6PJEKT9ezLnnKUQX2Q/bZ7paQPCZgpkgIym5 fDsyaJ07NEfkTvJ081MypuIFXDDC5lLgG02LC3T6oGuyC9Cje8Vyj2r37JFBHGe585ME apqvb7nBTFHRLcD0dHoNqrvxLv4Dl1LopqHduyV6YQ3+VILDd2sv+VJgLDqC0YljoT1s ug== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2gu2sr80e7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 20 Mar 2018 13:01:36 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2KD1ZJm009822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 20 Mar 2018 13:01:35 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2KD1Zbt021561 for ; Tue, 20 Mar 2018 13:01:35 GMT Received: from kholmanskikh.ru.oracle.com (/10.162.81.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Mar 2018 06:01:35 -0700 From: Stanislav Kholmanskikh To: ltp@lists.linux.it Date: Tue, 20 Mar 2018 16:02:30 +0300 Message-Id: <1521550951-8124-1-git-send-email-stanislav.kholmanskikh@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20180320120134.GB9226@ai> References: <20180320120134.GB9226@ai> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8837 signatures=668693 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.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, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: vasily.isaenko@oracle.com Subject: [LTP] [PATCH V2 1/2] restore_max_page_sharing: restore the value only if it was saved X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Documentation/vm/ksm.txt states that the minimum value for max_page_sharing is 2, so we can use it as a flag to test if save_max_page_sharing() was called before. Signed-off-by: Stanislav Kholmanskikh --- Changes to V1: - made the change to restore_max_page_sharing() following Cyril's proposal - split V1 into two patches, one - restore_max_page_sharing(), the other - ksm tests testcases/kernel/mem/lib/mem.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c index 4992843..f36b33a 100644 --- a/testcases/kernel/mem/lib/mem.c +++ b/testcases/kernel/mem/lib/mem.c @@ -250,6 +250,15 @@ void save_max_page_sharing(void) void restore_max_page_sharing(void) { + /* + * Documentation/vm/ksm.txt states that the minimum + * value for max_page_sharing is 2, so on + * max_page_sharing != 0 after save_max_page_sharing() + * returns. + */ + if (!max_page_sharing) + return; + if (access(PATH_KSM "max_page_sharing", F_OK) == 0) FILE_PRINTF(PATH_KSM "max_page_sharing", "%d", max_page_sharing);