Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1449166ybe; Wed, 11 Sep 2019 15:24:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIGrotFN6Z0lUM7DpHBq8cQ+t/fsbbE2ktk6vPAgEoVLXZDAI7TRfUuo78MwsToK2Nc/WI X-Received: by 2002:aa7:dcc3:: with SMTP id w3mr39122731edu.202.1568240688372; Wed, 11 Sep 2019 15:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568240688; cv=none; d=google.com; s=arc-20160816; b=anbpDhH8OWw0DsHUv2KR+q5nGGiquwC75j3/arvalIr+bWVVd9T7I3VBml/Q3rYm27 YCS+ADrfrPVUEQLmYdyRgVakerQd/teMqmwcQzdLu/GbpVwEXUaUk8xh7NerhZIbYwO1 SGZfl4l7vO5KBTEeOpeKGYCbWpRBrslhPQlHZFUVqqTyt4b4MdOAM5WHFsVAXushYYlw RgQMIZYVMeprkWZ6JhtRWHAhp4J7oh8YK/fJU+opasTKkIJByHjiKOSs2TWCGqakTKS1 W2GIQRtbdJUijFV4q4jkGCwlTGpctWcLnB6wDEhPRHUhhm1EybLy+Ot8Fxo1t5sB4Zml o15Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9jE3mtkHHko+7r8PMAvmKkCu21SGOTAKiQ2sFX5q1e8=; b=bEySWJ0r+1EnR57NcD7AyofeJms0mZ+Nm1BLJmFMVgo8m/kHv0LJzQf8wMCze/76Uh MtCz4pRc5+9iOn1sg0L4m369UeaGTlsMTbCn0wxbR6b0vZsekAzd/EGbHARsH/Vk00ni KnsAQpYTWzusozAgR5sTI4KFVJStP4ERAeBs/8KNRFWLPUMWYfhiuGkmsOwXiC3ibmQc mGReUdgStMaLsoCMVufumBY1El4FS4rQMFlnzQvnrS4IrLkBV66xEtVpjjGfjXZuGlGw fyvI2X0cn3tmD7hq6ncyOT0+YnQGXn95jc4yLEo4R/cssT8YvxIRjHE5rX9YWO3wmqCq m6CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YuuZ1SR9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si12383582ejj.37.2019.09.11.15.24.25; Wed, 11 Sep 2019 15:24:48 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YuuZ1SR9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730434AbfIKT5v (ORCPT + 99 others); Wed, 11 Sep 2019 15:57:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54668 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbfIKT5u (ORCPT ); Wed, 11 Sep 2019 15:57:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9jE3mtkHHko+7r8PMAvmKkCu21SGOTAKiQ2sFX5q1e8=; b=YuuZ1SR9/A3UTMvsgjSd5CDmd Bht4qf7T7gzPP6ceP3qR0rUCabFLX3Ofmr1X48wwNvc7OioQfaRQY15yoV7wM8Md+Lttifi18jP4N 2zoqeakteIneE6RomJ18Svhc3HMcSNpA9808NWbTJed7wGaWgOW4NIpEuLgedepcI9h5LOFReSKD8 3JDMy6OdPsmFtRfTBIR+HfAyJMgJ+Jnj8cBaaEyynEzWbevqJ6Z1x/AzF0dzQP9Uw1L3uZzKSJVM/ TwSAA+eEApViP9KU8PZo0eQ0O/NEK3imDNt2fcN+0/CxKA18HaTn+i8NqOpUxE/Zb8FY+MwvYdPuH GiGSo8+Vg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1i88kL-0007F3-I8; Wed, 11 Sep 2019 19:57:45 +0000 Date: Wed, 11 Sep 2019 12:57:45 -0700 From: Matthew Wilcox To: Waiman Long Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Alexander Viro , Mike Kravetz , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Davidlohr Bueso Subject: Re: [PATCH 5/5] hugetlbfs: Limit wait time when trying to share huge PMD Message-ID: <20190911195745.GI29434@bombadil.infradead.org> References: <20190911150537.19527-1-longman@redhat.com> <20190911150537.19527-6-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911150537.19527-6-longman@redhat.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 04:05:37PM +0100, Waiman Long wrote: > To remove the unacceptable delays, we have to limit the amount of wait > time on the mmap_sem. So the new down_write_timedlock() function is > used to acquire the write lock on the mmap_sem with a timeout value of > 10ms which should not cause a perceivable delay. If timeout happens, > the task will abandon its effort to share the PMD and allocate its own > copy instead. If you do a v2, this is *NOT* the mmap_sem. It's the i_mmap_rwsem which protects a very different data structure from the mmap_sem. > +static inline bool i_mmap_timedlock_write(struct address_space *mapping, > + ktime_t timeout) > +{ > + return down_write_timedlock(&mapping->i_mmap_rwsem, timeout); > +}