Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1831605imm; Thu, 23 Aug 2018 09:26:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzvcj5bQgD4P47dtp5XSB2++0+ZRbY/HJlq9XK26nJOfo8juhEF0T6njgVD7y/p0xy7rmcg X-Received: by 2002:a63:d613:: with SMTP id q19-v6mr56511146pgg.327.1535041609158; Thu, 23 Aug 2018 09:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041609; cv=none; d=google.com; s=arc-20160816; b=PirwvFzgZfKY/bfhXlkWrmmeLJek25ffvFHfmgAl1jy1S4W0Gu2r6CdX1bU/9Z5Am9 063s65V3YJ6hkm6V13oCmgx0CnrTniSXcba3dlFUOCsuNmxNrx1IL/gAKKPm7CtUgMXI qDXpqOK8eDDZlMV1W9p/sMdQtVm0XJVfHN1RDNKbTiRU0bREyIAUIxf7BG8vGVTClQIC /Q/XaGLETwDf1MtsDWfEz47peOOrxohxuEn6bYneldaDMNluZSJ2zk2uJxJxR0P4xJDK MHOOeOcA0Y4r7OBZ+2SzEXj3rGaiNKJWqpT4z5jn14aVOx1oIYhCQl8CYkanzd02+tvO avsg== 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=kmh/MLSMNNDYU9jaU3y1wOSCQm3EvpBtD1132JZfvOg=; b=uw6OKakKJJNn2swpVDcRMAN80cokrj5wMPSUfimX0DkVRZBswlXWem61tVZFDVUnj6 w9Jg3lSThziRwCjTjrnUSg8PD4BSdW7gFnLyyR+248GQGwRjIP8966lQN3fJSj38QhMb BDe2suH/05QLeUAaxYKSPxb085xPMyWhosQmuFbe7/lJCh82ooMsY39gYWSKeAhSJdvy +rDjQAWVOZisDP1UTTcaCnIEzTZgx1Bt/j68yQbSRGG3kvT5iMijbteTtEaHzMZtjS2L gkP06IKJAkNswUtoPrLoKnouP5imcldBw8uCcdhOk+RnffsuZHbID5xX4IaRb+fxb1c+ z8Qg== 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 r22-v6si2817566pgb.509.2018.08.23.09.26.33; Thu, 23 Aug 2018 09:26:49 -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 S1732260AbeHWRvJ (ORCPT + 99 others); Thu, 23 Aug 2018 13:51:09 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:38873 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731404AbeHWRvI (ORCPT ); Thu, 23 Aug 2018 13:51:08 -0400 Received: from fsav104.sakura.ne.jp (fsav104.sakura.ne.jp [27.133.134.231]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w7NEKwrJ000113; Thu, 23 Aug 2018 23:20:58 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav104.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav104.sakura.ne.jp); Thu, 23 Aug 2018 23:20:58 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav104.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 w7NEKvIB000109 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Aug 2018 23:20:57 +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 Cc: Andrew Morton , linux-mm@kvack.org, xen-devel@lists.xenproject.org, LKML , Boris Ostrovsky , Juergen Gross References: <20180823120707.10998-1-mhocko@kernel.org> <07c7ead4-334d-9b25-f588-25e9b46bbea0@i-love.sakura.ne.jp> <20180823135151.GM29735@dhcp22.suse.cz> From: Tetsuo Handa Message-ID: <470950f0-a579-6c74-c5f0-bea635259176@i-love.sakura.ne.jp> Date: Thu, 23 Aug 2018 23:20:54 +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: <20180823135151.GM29735@dhcp22.suse.cz> 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 22:51, Michal Hocko wrote: > You are right. I completely forgot I've removed in_range there. Does > this look any better? > > diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c > index e7d8bb1bee2a..30f81004ea63 100644 > --- a/drivers/xen/gntdev.c > +++ b/drivers/xen/gntdev.c > @@ -525,14 +525,20 @@ static int mn_invl_range_start(struct mmu_notifier *mn, > return -EAGAIN; > > list_for_each_entry(map, &priv->maps, next) { > - if (!blockable && in_range(map, start, end)) { > + if (in_range(map, start, end)) { > + if (blockable) > + continue; > + > ret = -EAGAIN; > goto out_unlock; > } This still looks strange. in_range() returns false if map->vma == NULL. But unmap_if_in_range() unconditionally dereferences map->vma->vm_[start|end] . Suggestion from Boris looks better. > unmap_if_in_range(map, start, end); > } > list_for_each_entry(map, &priv->freeable_maps, next) { > - if (!blockable && in_range(map, start, end)) { > + if (in_range(map, start, end)) { > + if (blockable) > + continue; > + > ret = -EAGAIN; > goto out_unlock; > } >