Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4874431imu; Tue, 29 Jan 2019 08:57:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN72oCrBav51/ofHXUUzxuLvPb4FAL7apUbZtiRgUswUM38sJJciPeq3/RTL1ZmFCj13W5rr X-Received: by 2002:a62:e704:: with SMTP id s4mr27237064pfh.124.1548781054969; Tue, 29 Jan 2019 08:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548781054; cv=none; d=google.com; s=arc-20160816; b=KqRRUxpy1xdRyoFprr3HTb8qX2StOUee2FIOEmvzZWCeg+BroUK7QusYxJzuPUzcc/ 53Ro0nuVmeEe5WanRgbxNiHZogXecGGUqeCOB1qYgrMag9Uci7qnTk8osDPp+WyhMmMk a7GqJgfxyLv2FeoQDQCmqAjZ56qsnKcebj8RpvQOQFEPpolZSQlbsSiktgJ3bqvQ/7OZ eQiC8zOYnCNmWctfzLJnlrerODOIO1PFkZdqD2YrtvYiaAx8UGTyDvD9kl/SZEwVIy5c u/eO2QMGcPt/kFIyYm5xsueE5ht+hCIyHCG/M1ooV3rlVqqeQHfMwWK6lOWad6tdIryC h+FA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QcLzV1gGPkQedQiJBQ1N5gPCY/e3jxaa42upoNgKKqI=; b=Tf+s+eIdk6zjUy+KRyRhZgjHMVfo7nV5n+3jmFgWrloE8LSoMht2vRjLBAJ8U5ib1Y qyAbL99Sq/f1neyg86ofGmPey8cJHA6Ibmo9botHvUtHIHCktj3KvfM35NlEFBTY6pNS 9LTBDWoL9Ttk0trTO/RN31FOynHZjeCgIKu5KnBgnL5yB3j4nqTyWL8KMCijaVJXCR+q AQKVKVmoQ4iZadpzW0bjdJnIfWSY4ZnYJE7BEGHGDEEXKaPv1R8Gc4gAxWEzV86XgwM3 3rJZy6nyfEqTgbD/5iiedVTv/1Kj6NfPxuVDSiw0ueEZ52ZpBOpC2aCOkiojocDbDNrX 887g== 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 k7si1488518pgm.462.2019.01.29.08.57.19; Tue, 29 Jan 2019 08:57:34 -0800 (PST) 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 S1728641AbfA2Qyn (ORCPT + 99 others); Tue, 29 Jan 2019 11:54:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37274 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728544AbfA2Qyl (ORCPT ); Tue, 29 Jan 2019 11:54:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1D3237E8E; Tue, 29 Jan 2019 16:54:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-122-2.rdu2.redhat.com [10.10.122.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC35D102BCEB; Tue, 29 Jan 2019 16:54:39 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Andrew Morton , Ralph Campbell , John Hubbard Subject: [PATCH 02/10] mm/hmm: do not erase snapshot when a range is invalidated Date: Tue, 29 Jan 2019 11:54:20 -0500 Message-Id: <20190129165428.3931-3-jglisse@redhat.com> In-Reply-To: <20190129165428.3931-1-jglisse@redhat.com> References: <20190129165428.3931-1-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 29 Jan 2019 16:54:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jérôme Glisse Users of HMM might be using the snapshot information to do preparatory step like dma mapping pages to a device before checking for invalidation through hmm_vma_range_done() so do not erase that information and assume users will do the right thing. Signed-off-by: Jérôme Glisse Cc: Andrew Morton Cc: Ralph Campbell Cc: John Hubbard --- mm/hmm.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/hmm.c b/mm/hmm.c index b9f384ea15e9..74d69812d6be 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -170,16 +170,10 @@ static int hmm_invalidate_range(struct hmm *hmm, bool device, spin_lock(&hmm->lock); list_for_each_entry(range, &hmm->ranges, list) { - unsigned long addr, idx, npages; - if (update->end < range->start || update->start >= range->end) continue; range->valid = false; - addr = max(update->start, range->start); - idx = (addr - range->start) >> PAGE_SHIFT; - npages = (min(range->end, update->end) - addr) >> PAGE_SHIFT; - memset(&range->pfns[idx], 0, sizeof(*range->pfns) * npages); } spin_unlock(&hmm->lock); -- 2.17.2