Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1830272imm; Thu, 23 Aug 2018 09:25:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbstpVUS3fbMk5GWkn8AgoHWDlzRoJNxGhKh5U1q65fkNEGwd5woU7qEkIyFjlBxGHX1+Si X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr1837212plv.193.1535041529956; Thu, 23 Aug 2018 09:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041529; cv=none; d=google.com; s=arc-20160816; b=q0q2MFq6YWjDI+ohRGbLVD8jsVl9zA5P7LML12pN2ftPdWocC+4iSsyJYMvq/Jx/q5 vE1DB3tqNE+MP7PCuju+5gNjun9EJcIbMIrmJYejcC3q/zGYqL7g90R5Vkrv6ZfwEMxp gOzM0Ll5dvf+/Xa6QS2/34+9Fc6OO6Iexhprus6n8LXVMoIvl7vlX8J4hD+rYcJvS2hE hhBB6Ap/Iw1yO4dpl2k5YvidlR6WP9o0Smjz36ktAr0WtZPWKIPrIMe2DYUWoUFG9XYM uVb2ou8KEYZ7DHI4Kgm99d8zck/lpeIXnTDp1uDsIloGaTSI07+S/mdABeKzGZRZicxm ydhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=4fv2yQpw84SMEUaBWvpluLpsxDl0TXdaaIR3u7pT6tA=; b=wN0NShO6BOrIT6qyGkIYU0lMKaRqyGws/P0LUvjSHqeP9/jSLSr1nslPJf7mAAmE4J e0KgitLl4rT3HHwoGRB56cFK9fLIFAsqf4p7QCay+JUFhIL69k39ICHC9PfQiaA2ZzEc kKRi+HI5Ufxv5L+KBspDITmv8xSwjk/20wvfRP90Q95KQcN6IAeMzWbzrj1Ym8ORM5F8 QFvmy4lTtKyNHE7XVhySJHqvfV98RIV7chaiRAOIdbUCUl79VSGOVRmOpmx/kgkMIz6E AE3ELwTDyuV20Oc7tfwmhpcuqDDPdG+IIMiOg81AlKF+kYla4Ck6OSVrFQG+oDAMaWLx kdvQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4-v6si4651766pgi.69.2018.08.23.09.25.14; Thu, 23 Aug 2018 09:25:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732216AbeHWROD (ORCPT + 99 others); Thu, 23 Aug 2018 13:14:03 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:51524 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731372AbeHWROD (ORCPT ); Thu, 23 Aug 2018 13:14:03 -0400 Received: from fsav303.sakura.ne.jp (fsav303.sakura.ne.jp [153.120.85.134]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w7NDiFZA065798; Thu, 23 Aug 2018 22:44:15 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav303.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav303.sakura.ne.jp); Thu, 23 Aug 2018 22:44:15 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav303.sakura.ne.jp) Received: from [192.168.1.8] (softbank060157066051.bbtec.net [60.157.66.51]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w7NDi9qO065733 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Aug 2018 22:44:14 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] xen/gntdev: fix up blockable calls to mn_invl_range_start To: Michal Hocko , Andrew Morton Cc: linux-mm@kvack.org, xen-devel@lists.xenproject.org, LKML , Michal Hocko , Boris Ostrovsky , Juergen Gross References: <20180823120707.10998-1-mhocko@kernel.org> From: Tetsuo Handa Message-ID: <07c7ead4-334d-9b25-f588-25e9b46bbea0@i-love.sakura.ne.jp> Date: Thu, 23 Aug 2018 22:44:07 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180823120707.10998-1-mhocko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/08/23 21:07, Michal Hocko wrote: > diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c > index 57390c7666e5..e7d8bb1bee2a 100644 > --- a/drivers/xen/gntdev.c > +++ b/drivers/xen/gntdev.c > @@ -519,21 +519,20 @@ static int mn_invl_range_start(struct mmu_notifier *mn, > struct gntdev_grant_map *map; > int ret = 0; > > - /* TODO do we really need a mutex here? */ > if (blockable) > mutex_lock(&priv->lock); > else if (!mutex_trylock(&priv->lock)) > return -EAGAIN; > > list_for_each_entry(map, &priv->maps, next) { > - if (in_range(map, start, end)) { > + if (!blockable && in_range(map, start, end)) { This still looks strange. Prior to 93065ac753e4, in_range() test was inside unmap_if_in_range(). But this patch removes in_range() test if blockable == true. That is, unmap_if_in_range() will unconditionally unmap if blockable == true, which seems to be an unexpected change. > ret = -EAGAIN; > goto out_unlock; > } > unmap_if_in_range(map, start, end); > }