Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp19360imm; Tue, 28 Aug 2018 15:06:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYPnHAhkVTWL7Y8gc3VCzdiwE+pMgejl0j+eS4Mzdi0V90ZPlFab+94uVX3ldZHohO36H9V X-Received: by 2002:a17:902:bb85:: with SMTP id m5-v6mr3280830pls.46.1535493972448; Tue, 28 Aug 2018 15:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535493972; cv=none; d=google.com; s=arc-20160816; b=nMFPpweG96+Mu3fk5RdU5qjnTXwPRfL3qOzCL1BaXwaj2mH3dra091SNW6wx5/2/4v slFxwsx6fD0DlioYVZEc7FaS8g4EaCsj9e/kNJYMXHMiO2U9a3yeMfTc40eFSh1OhBaP JloiU3oXVBYJH2IY2Nd/6WWySszK2wTXuN4pMKK5FwlZoB7aqRxReIqcbXHnnR6Wn6HB emzkS7pfkQ/T2LgcBki2T0WiOHI2L4OAZ+4peOdSjHHcCBDcOF8z9Cj2GHSmEAMkq/GC xgU1X3/R6djDD7Zy2QQ9iTCd6UNiKMc9mz3DhzOLbBU4qi54QV/fo3nsTEkFOoZD6AFS OD1g== 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:arc-authentication-results; bh=KLDEt+uQCAiMUZcj+l7cWxyM2azHLk+NlXUdok09dRg=; b=wUx3ueVFrP1/0W6gaaN9NTgWYfNoqxCm9Ja5iCYA5RriCh5/PHjiHTkrDoNNBIWyPI 7rE4wzZ5jUtG3PnsPc8/+leJtXFU9icl6MWZ7/7yzunDjn5BupljoR5XI80peNXZaGWk 4/UeMEfCbBmqyGIsM4VuVBhg0BTJElVIHNezOYpZ1qMKAV5MzgIshbC1uKdWMDYjTL+C dWYZaoQHbpVHqLq7PPoOVa2LppfOqe0GsI3L6uNDiGdgmg40kN+GH1b+lu13Ixrbgz7h S5+KIFk8AukYqkivzxFCNKooLTTfpKZVBvWU2/IY8aaiZmeuohFnzY0pikqcR8h2gGqW XshA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=o0oUUrY5; 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 k198-v6si1998604pgc.442.2018.08.28.15.05.55; Tue, 28 Aug 2018 15:06:12 -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=o0oUUrY5; 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 S1727344AbeH2B6I (ORCPT + 99 others); Tue, 28 Aug 2018 21:58:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55552 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbeH2B6H (ORCPT ); Tue, 28 Aug 2018 21:58:07 -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=KLDEt+uQCAiMUZcj+l7cWxyM2azHLk+NlXUdok09dRg=; b=o0oUUrY5xBqhwfs2emUh4eTb2 JKYxAdgckP3sZ6m06c7N2Ye3X8Dfke+yH/XyAVmZBkUPc/7YxZxREGSijJFoQrk6fgqr14PnIrDwM sAYxMkJeJ3mBKEcBD66Hgtxog+o6sBkPeNQuud/gdfv3hlpOjRFEHPl8ZPtuA1z7SgvlIAiURsOsb aV8MiWph3saiiUFD3NYpMFLW45wpOylgqh9kC857WXEaGm1CAUEz5LfgeF0DQmSVMHX+tERgBcTQ8 NYBmF+mhsrwdsSFC7wtYn3o0Xgpy8YTb6Jfqnqo27SS0QBx9VEPpk3BMqmfQ+LkA82RdmxXUjBtoZ X1eHU5+6g==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fum67-000610-EN; Tue, 28 Aug 2018 22:04:27 +0000 Date: Tue, 28 Aug 2018 15:04:27 -0700 From: Matthew Wilcox To: Nicolas Pitre Cc: Andrew Morton , Souptick Joarder , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/10] cramfs: Convert to use vmf_insert_mixed Message-ID: <20180828220427.GA11400@bombadil.infradead.org> References: <20180828145728.11873-1-willy@infradead.org> <20180828145728.11873-2-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 28, 2018 at 01:49:25PM -0400, Nicolas Pitre wrote: > On Tue, 28 Aug 2018, Matthew Wilcox wrote: > > - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); > > + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn); > > + if (vmf & VM_FAULT_ERROR) { > > + pages = i; > > + break; > > + } > > I'd suggest this to properly deal with errers instead: > > - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); > + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn); > + if (vmf & VM_FAULT_ERROR) > + ret = vm_fault_to_errno(vmf, 0); By my reading of this function, the intent is actually to return 0 here and allow demand paging to work. Of course, I've spent all of twenty minutes staring at this function, so I defer to the maintainer. I think you'd need to be running a make-memory-allocations-fail fuzzer to hit this, so it's likely never been tested.