Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp89344imm; Tue, 28 Aug 2018 16:53:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbQphEJMm954pJZzbOLhe5JXbpc5e1TmGy+abncj2K9D1ZJjfK2S6JrmvUuT5bJcQ5VGehK X-Received: by 2002:a63:eb0e:: with SMTP id t14-v6mr3548154pgh.198.1535500435230; Tue, 28 Aug 2018 16:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535500435; cv=none; d=google.com; s=arc-20160816; b=VXPxPTSJnB4XYoBesF3PWfJWtnqrgkoYZJtJG9LnCM1wL3uR5T3mnSdgHsNrfGCnx/ MixRtEiBlFg/kSBM2q6diliGLPzc6GXT0cjiBy6W0lVjzvdn59Y90G/iOfO5gCOra9MN v+mNFvU0QA4isEqBSkcu870j8lAGDtRZJMmnME6jMFurz5+5g6uzbBbEiAXEvIhA2rpO WtmLuPzIU4gbqwG0W7iJ6rZW4e3Z32kSA4/PRqK6SoS41HJSKhGqylVHhY/odJ/nWc0s PQUASCDR+TE71CisxM9PgTKNtTCGrDR8ZhE+MhkXyVgJ6ogiMfLx40eRoZwVjp8w8b6j +14Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=H7DJrGqGJef5RWJ0y5DZALQeh35kEgheLtOZvllkCnc=; b=LCbVP0hJ15jDewZBrNTFRyEZglUKs8s4F1aeRshBTU7ZfAyMJGVyQPYBiGs2yDC4uu 31fI6LNICfQPfRkI0XHPI9tgrRSG+XOr+zU4yk+pqtqFpPYKsk/sjZphpOyORsrLTHdy s+Oq5w/3oM2XKLsUVilPFT0dbyPj9wdHNkwO1Zyd6Og5XMn9k6r87XGli96Iz/G4jwXA 7EOhzehx8pUhRjN53DWcwn1XlVU10gqM02STNB2xyUPUwTWGkaBogD0Ye8dn5U0dO1FO oj/1Y4iEe2IKPfsYQ0Dq8eNeza/t1t3u7yoLA99FXZpccOjd/tONDu4Y46123eD8iKtd HW6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=giXL20cY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si1901140pff.91.2018.08.28.16.53.39; Tue, 28 Aug 2018 16:53:55 -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=pass header.i=@linaro.org header.s=google header.b=giXL20cY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbeH2DqI (ORCPT + 99 others); Tue, 28 Aug 2018 23:46:08 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:39681 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727216AbeH2DqI (ORCPT ); Tue, 28 Aug 2018 23:46:08 -0400 Received: by mail-qt0-f195.google.com with SMTP id o15-v6so3833240qtk.6 for ; Tue, 28 Aug 2018 16:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=H7DJrGqGJef5RWJ0y5DZALQeh35kEgheLtOZvllkCnc=; b=giXL20cYnifrHmrue3Rshzt+d2Ui6aMF6nY5xkgKCW+18gAmOwkTYjAFTl3Ipq3oAG nFcm+VLAYh6oZUTNf8KNTWtmSdRE4xaAoVAR+Weu6RqD79OP7vYuzF0DZhw60b0V9wNK O3/31wBSBYMiX+WfadYSPNCgDC3ODbwShvRx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=H7DJrGqGJef5RWJ0y5DZALQeh35kEgheLtOZvllkCnc=; b=AzsJiJ8v6DyKWgXcBZYvJ6BjXXWD/iBYC8Om5eb3YJqROZd8VlmYiTk2fYwPIJxW0b ZdvEoDT9n8DE7njDOsNk/63a68+fBeqv7snpg3UR2t66NaW6rd03pCFHz36Strj++iiR ciP8Nur+1QjvvfzIVjtNsRi9yqmz8F4AwR6/yjHK0r1bpysqOSzsUQ36kFDqZbKG3oBO Wj0XEK7VGpdGFTEdH7W5eJd+AeyQ8QeQm641tbuSdmW4VsweAQg7wq8jvAW3JG7fs+6N IZSJNDxukNBd2ov/fZy4Fqq2s5TuAi40KUOqNGfXs46xSOJFjG5utaYaz3Em4AndicHR SPhg== X-Gm-Message-State: APzg51CUaQmDUjErkPQb3Az0Dch0adaxt2dVKEYI4PUagXm6nrrZJNtQ 13+2P4RdhzxUDCMiLPVgdubQsA== X-Received: by 2002:ad4:50ce:: with SMTP id e14-v6mr3956825qvq.232.1535500325441; Tue, 28 Aug 2018 16:52:05 -0700 (PDT) Received: from xanadu.home (modemcable228.104-82-70.mc.videotron.ca. [70.82.104.228]) by smtp.gmail.com with ESMTPSA id w9-v6sm1643608qta.13.2018.08.28.16.52.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 16:52:04 -0700 (PDT) Date: Tue, 28 Aug 2018 19:52:03 -0400 (EDT) From: Nicolas Pitre To: Matthew Wilcox 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 In-Reply-To: <20180828220427.GA11400@bombadil.infradead.org> Message-ID: References: <20180828145728.11873-1-willy@infradead.org> <20180828145728.11873-2-willy@infradead.org> <20180828220427.GA11400@bombadil.infradead.org> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Aug 2018, Matthew Wilcox wrote: > 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. Demand paging is used when the filesystem layout isn't amenable to a direct mapping. It is not a fallback for when we're OOM or some other internal errors which ought to be reported immediately. > I think you'd need to be running a make-memory-allocations-fail fuzzer > to hit this, so it's likely never been tested. Well, it has been tested sort of, e.g. when vm_insert_mixed() returned an error due to misaligned addresses during development. Normally, vm_insert_mixed() and vmf_insert_mixed() should always succeed, and if they don't we certainly don't want to ignore it. Nicolas