Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3688220imm; Mon, 6 Aug 2018 08:56:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdoXddXa3FQkASb6TN6W5NzuQv7N7csKui8r70AeRRHRmMPbxEeHhd5FEIaGWLUeq5SNSxs X-Received: by 2002:a62:c00c:: with SMTP id x12-v6mr17755422pff.216.1533570983771; Mon, 06 Aug 2018 08:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533570983; cv=none; d=google.com; s=arc-20160816; b=oWXLH6XKwY7UVCqwD90mXzZ8HiFOeyeu6cfVlMrNt87LWMLlynH3o5ZPa9rb/UaugY xiAdSnjeBEDutvZ5WN3+10cwpFuXvYRHcpUbTjWnJW2ZoGxnn5tY++J16PZ0jePZEuwD bXrlihXig56I/F6bY7lGfj9LwUq+8TBMZ7Ym7qivP7axjvDH61eHCHNdyNlArBmBMQot KewLc2pDYUOloUQMttDGRdJgkZ/Q3Ln3GiROHsXXu0V6ojNPxBI72JQlUbQEOZd2PZCW ohDBwKW8CabnstORbbNhSH59Pgv/vcpNsHwINF5Eab+wUciF7+F7nXM/BCxSiq1EFBs8 T7wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cL53SJmhVijY880gNETH/WBjchvYNCSGAxaCFf5ygVA=; b=exNPjwUpxTDFyJwXdUuooOIgqcGm/WOADz0q0TVIG4KLkUwwyM8eH4mSink2izQ3Mv m1d8tK/WdjsNIs2GuFOWVNqTOcHXnG1TP0jAyYH++W3jw+pUq8mJNNnheuB/Z6a1cjCu SYCEJSuEVnYjiA4MPFqIK2WY919WLnIhJYiQXtVC453I3UA5Y2mqwBZf+xm9KZHKzOWr z8+U/HEa1yLKLuqiFDtpV1f0dpt9RYh03uoYqjWIsqBUZnF8p77tZr5/W16gUDV5FNs0 R19PgbwFHmT4dUMajGlChJf65w054pPa+fSzu1JIT1lgTNaCokNj25v0eQBxRSUxkfq3 Wvrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184-v6si13423605pgj.421.2018.08.06.08.56.08; Mon, 06 Aug 2018 08:56:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733036AbeHFSDx (ORCPT + 99 others); Mon, 6 Aug 2018 14:03:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33810 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732396AbeHFSDw (ORCPT ); Mon, 6 Aug 2018 14:03:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E76A7C6CA; Mon, 6 Aug 2018 15:54:09 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-134.ams2.redhat.com [10.36.117.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 009552026D76; Mon, 6 Aug 2018 15:54:07 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, Heiko Carstens , Martin Schwidefsky , Cornelia Huck , David Hildenbrand , Janosch Frank , Christian Borntraeger Subject: [PATCH] s390x/mm: avoid taking the table lock in gmap_pmd_op_walk() Date: Mon, 6 Aug 2018 17:54:07 +0200 Message-Id: <20180806155407.15252-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 06 Aug 2018 15:54:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 06 Aug 2018 15:54:09 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Right now we temporarily take the page table lock in gmap_pmd_op_walk() even though we know we won't need it (if we can never have 1mb pages mapped into the gmap). So let's special case this, so gmap_protect_range()/gmap_sync_dirty_log_pmd() will not take the lock in case huge pages are not allowed. gmap_protect_range() is called quite frequently for managing shadow page tables in vSIE environments. Signed-off-by: David Hildenbrand --- arch/s390/mm/gmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index bb44990c8212..d4fa0a4514e0 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -905,10 +905,16 @@ static inline pmd_t *gmap_pmd_op_walk(struct gmap *gmap, unsigned long gaddr) pmd_t *pmdp; BUG_ON(gmap_is_shadow(gmap)); - spin_lock(&gmap->guest_table_lock); pmdp = (pmd_t *) gmap_table_walk(gmap, gaddr, 1); + if (!pmdp) + return NULL; - if (!pmdp || pmd_none(*pmdp)) { + /* without huge pages, there is no need to take the table lock */ + if (!gmap->mm->context.allow_gmap_hpage_1m) + return pmd_none(*pmdp) ? NULL : pmdp; + + spin_lock(&gmap->guest_table_lock); + if (pmd_none(*pmdp)) { spin_unlock(&gmap->guest_table_lock); return NULL; } -- 2.17.1