Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442AbdGXLZj (ORCPT ); Mon, 24 Jul 2017 07:25:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:49845 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751558AbdGXLZf (ORCPT ); Mon, 24 Jul 2017 07:25:35 -0400 Date: Mon, 24 Jul 2017 13:25:30 +0200 From: Jan Kara To: Ross Zwisler Cc: Andrew Morton , linux-kernel@vger.kernel.org, "Darrick J. Wong" , "Theodore Ts'o" , Alexander Viro , Andreas Dilger , Christoph Hellwig , Dan Williams , Dave Chinner , David Airlie , Ingo Molnar , Inki Dae , Jan Kara , Jonathan Corbet , Joonyoung Shim , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Matthew Wilcox , Patrik Jakobsson , Rob Clark , Seung-Woo Kim , Steven Rostedt , Tomi Valkeinen , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org, linux-samsung-soc@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v4 1/5] mm: add mkwrite param to vm_insert_mixed() Message-ID: <20170724112530.GI652@quack2.suse.cz> References: <20170721223956.29485-1-ross.zwisler@linux.intel.com> <20170721223956.29485-2-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170721223956.29485-2-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 527 Lines: 20 > @@ -1658,14 +1658,28 @@ static int insert_pfn(struct vm_area_struct *vma, unsigned long addr, > if (!pte) > goto out; > retval = -EBUSY; > - if (!pte_none(*pte)) > - goto out_unlock; > + if (!pte_none(*pte)) { > + if (mkwrite) { > + if (WARN_ON_ONCE(pte_pfn(*pte) != pfn_t_to_pfn(pfn))) Is the WARN_ON_ONCE() really appropriate here? Your testcase with private mappings has triggered this situation if I'm right... Otherwise the patch looks good to me. Honza -- Jan Kara SUSE Labs, CR