From patchwork Tue Sep 27 07:45:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Latvala X-Patchwork-Id: 9351571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 914F5600CB for ; Tue, 27 Sep 2016 07:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 842A32907E for ; Tue, 27 Sep 2016 07:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78293290D1; Tue, 27 Sep 2016 07:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 160A42907E for ; Tue, 27 Sep 2016 07:52:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B80D06E610; Tue, 27 Sep 2016 07:52:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 421 seconds by postgrey-1.35 at gabe; Tue, 27 Sep 2016 07:52:42 UTC Received: from johanna4.inet.fi (mta-out1.inet.fi [62.71.2.230]) by gabe.freedesktop.org (Postfix) with ESMTP id DA1E06E610 for ; Tue, 27 Sep 2016 07:52:42 +0000 (UTC) RazorGate-KAS: Status: not_detected RazorGate-KAS: Rate: 0 RazorGate-KAS: Envelope from: RazorGate-KAS: Version: 5.5.3 RazorGate-KAS: LuaCore: 215 2015-05-29_17-31-22 60ae4a1b4d01d14f868b20a55aced8d7df7b2e28 RazorGate-KAS: Lua profiles 78662 [Jun 02 2015] RazorGate-KAS: Method: none Received: from hufflepuff.adrinael.net (84.250.112.128) by johanna4.inet.fi (9.0.002.03-2-gbe5d057) id 57E91169001DE16E; Tue, 27 Sep 2016 10:45:40 +0300 Received: from adrinael by hufflepuff.adrinael.net with local (Exim 4.84_2) (envelope-from ) id 1bon5A-0003Up-7N; Tue, 27 Sep 2016 10:45:40 +0300 From: Petri Latvala To: intel-gfx@lists.freedesktop.org Date: Tue, 27 Sep 2016 10:45:17 +0300 Message-Id: <1474962317-13391-1-git-send-email-petri.latvala@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [Intel-gfx] [PATCH i-g-t] lib: Do two writes to /proc/sys/vm/drop_caches again X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The drop_caches sysctl has a max value of 4, so writing 7 to it just fails. Avoid the earlier two-writes problem by seeking to the beginning between writes. Signed-off-by: Petri Latvala --- lib/intel_os.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/intel_os.c b/lib/intel_os.c index b9f970d..cb3b062 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -299,11 +299,16 @@ void intel_purge_vm_caches(void) if (fd < 0) return; + /* BIT(2): Be quiet. Cannot be combined with other operations, + * the sysctl has a max value of 4. + */ + igt_ignore_warn(write(fd, "4\n", 2)); + igt_assert(lseek(fd, 0, SEEK_SET) == 0); + /* BIT(0): Drop page cache * BIT(1): Drop slab cache - * BIT(2): Be quiet in future */ - igt_ignore_warn(write(fd, "7\n", 2)); + igt_ignore_warn(write(fd, "3\n", 2)); close(fd); }