From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753200AbbC0VxP (ORCPT ); Fri, 27 Mar 2015 17:53:15 -0400 Received: from mga09.intel.com ([134.134.136.24]:62182 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752932AbbC0VxK (ORCPT ); Fri, 27 Mar 2015 17:53:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,481,1422950400"; d="scan'208";a="671692566" Subject: [PATCH 05/17] x86, mpx: trace when MPX is zapping pages To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@linutronix.de, Dave Hansen , dave.hansen@linux.intel.com From: Dave Hansen Date: Fri, 27 Mar 2015 14:53:01 -0700 References: <20150327215253.8583D538@viggo.jf.intel.com> In-Reply-To: <20150327215253.8583D538@viggo.jf.intel.com> Message-Id: <20150327215301.D1208022@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen When MPX can not free an entire bounds table, it will instead try to zap unused parts of a bounds table to free the backing memory. This decreases RSS (resident set size) without decreasing the virtual space allocated for bounds tables. Signed-off-by: Dave Hansen --- b/arch/x86/include/asm/trace/mpx.h | 22 ++++++++++++++++++++++ b/arch/x86/mm/mpx.c | 1 + 2 files changed, 23 insertions(+) diff -puN arch/x86/include/asm/trace/mpx.h~mpx-trace_unmap_zap arch/x86/include/asm/trace/mpx.h --- a/arch/x86/include/asm/trace/mpx.h~mpx-trace_unmap_zap 2015-03-27 14:35:05.577798421 -0700 +++ b/arch/x86/include/asm/trace/mpx.h 2015-03-27 14:35:05.582798647 -0700 @@ -53,6 +53,28 @@ TRACE_EVENT(bounds_exception_mpx, __entry->bndstatus) ); +TRACE_EVENT(mpx_unmap_zap, + + TP_PROTO(unsigned long start, + unsigned long end), + TP_ARGS(start, end), + + TP_STRUCT__entry( + __field(unsigned long, start) + __field(unsigned long, end) + ), + + TP_fast_assign( + __entry->start = start; + __entry->end = end; + ), + + TP_printk("[0x%p:0x%p]", + (void *)__entry->start, + (void *)__entry->end + ) +); + #else /* diff -puN arch/x86/mm/mpx.c~mpx-trace_unmap_zap arch/x86/mm/mpx.c --- a/arch/x86/mm/mpx.c~mpx-trace_unmap_zap 2015-03-27 14:35:05.579798511 -0700 +++ b/arch/x86/mm/mpx.c 2015-03-27 14:35:05.583798692 -0700 @@ -670,6 +670,7 @@ static int zap_bt_entries(struct mm_stru len = min(vma->vm_end, end) - addr; zap_page_range(vma, addr, len, NULL); + trace_mpx_unmap_zap(addr, addr+len); vma = vma->vm_next; addr = vma->vm_start; _