Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1037032ybe; Fri, 6 Sep 2019 10:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi8xwM+uZmtkmbErLCYjK0ZHz6RbkmmGIlMyUQ8Q84u2Yawn6BcprSFyPd9B2Vv8u1/A1Z X-Received: by 2002:a63:d210:: with SMTP id a16mr8866329pgg.77.1567792421278; Fri, 06 Sep 2019 10:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567792421; cv=none; d=google.com; s=arc-20160816; b=asZBAyp8nnOYahvlcAYK9LBHvhQ/SgMR49moLflL81w+c6U7b3G7vSHuEN4CdI5fL5 uYSZp1jwybrSMOwtV3tIJlzM44EeTHOb14f6V1iMcKlajaJgstJQBZ4i5rfudehQeMky erpg8mg6L/k/499afFWdtje/v8a0EqvZkL/ZOuKOVEKkmomdyqNIVQP6o7CUKK0BbgKL DgV8QcaxqxlQydtr5Ejk3IeUMJQUOsFTPpRBDzf+HWMk4r9S000OYuY3f6beuVN72pvZ Xkj2fPZMkh0Y+DIWWnb0sEc07hRTtz2QS0LRoLXbycfPb+D7gI055t62zZGQD/U6rVKr ZAEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uEuqyoR6pX9WcKO2lv8Qx9uofetASJrnmmBj7HQZAO0=; b=Omp8867tWhJrig5wop8EzNcfdUlddPP4YQJewH8SCBIWI86C2ErTY/5u0hO5dadDtT s0OCKK09K5Tn1fI0gMqNEfT2ZMzOgWejWwwPQD7m/vv2isVabEkr90o2qDEaYZuPUds/ OzVDrRHgw5cSb6XR/TDbwCoB/IhXCP3AIkxu5BCb7V4AMAfu2RJ0qtSgjLRo7SksD2jU ECHiUBFhzvqVhk/E7uZuFTodn17CEGpm9RPHWFyoUBme3eDsLnzgBi2+WW2HaQGup62K LIJsiwJ3sh+UvAcHp8f7MgRD8mlTMhTVTJG5rs3mg85+ZnFEm6pDatsOJD+IRdNa0Yj7 ArVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sPVCnusf; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v15si5397144plo.147.2019.09.06.10.53.23; Fri, 06 Sep 2019 10:53:41 -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=@gmail.com header.s=20161025 header.b=sPVCnusf; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391081AbfIFMYf (ORCPT + 99 others); Fri, 6 Sep 2019 08:24:35 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41172 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731928AbfIFMYe (ORCPT ); Fri, 6 Sep 2019 08:24:34 -0400 Received: by mail-lj1-f193.google.com with SMTP id a4so5814598ljk.8 for ; Fri, 06 Sep 2019 05:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uEuqyoR6pX9WcKO2lv8Qx9uofetASJrnmmBj7HQZAO0=; b=sPVCnusfoWpyRZ2QVHQwTwTXqVDSLABe1kb/Mev99Hg2vqfHfoVLATzkVRi2+ZQlU/ jUe4bKWmFENp+T5qqbKfZENo1l8dvYqIfw+OK9uKx8yblxrFiCq65laNMqVAldjVdmmu 1GzOuoVP5R+l+wfB6mShSS7GmPqISpD/ueZPYKZfKCo4BCRz7iD18iYuQ9oIlLVoA3Ah /NpIXrmXWC8JrXAC3FFaQ/G2EWcWlJXui2gM4J+oZH/lDDSMKALFRDkn2EyJjthC+RdX ZLl3lqv9OoD5ojMhnCCfHGU7MR8CdPT6nkoAHaWC5Fw6UNvT81yS99ZKj8c7hFrkikKG +JZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uEuqyoR6pX9WcKO2lv8Qx9uofetASJrnmmBj7HQZAO0=; b=LYWN0B78NqSKCY6en8SkJZB3WNtpSx7/WGceY0QOBx4ycQM1ibKERKd9pp6ZWwfSjn mcoFr5BZPm+qpcOedBSWaS+0jZvIME9wf+h2VLXgJV/7Spbot6ABqRypZjF/FjLS3shl WkIIYJK0CE/vEQu80uxPtBxMiqnVQZKdMGc9K4pgdeAxK/UtjQxHI2Ed1AyvU2MMwGL8 cKqzETC5iheC7Fm2hsSk2GTZVguvVAeV8xw4sqU+am1KXNSZjW+UF02wG4R1xPYyfbED TvqeJZdzx5APJp9gYal1FmLDF2gRfEfRA/kZPqFDXbwc/1DAhjIry/LzvrR9LWK9e9a9 BjQg== X-Gm-Message-State: APjAAAUZ7ScM0GG/cbL8nvbGptufkaGwABhMuF9BJGrA8fCbGRF788M7 3AUGXwnz8WewhjlSrMH6UvcE/h8/JbELkNsk2OY= X-Received: by 2002:a2e:9104:: with SMTP id m4mr5521513ljg.28.1567772673112; Fri, 06 Sep 2019 05:24:33 -0700 (PDT) MIME-Version: 1.0 References: <1567708980-8804-1-git-send-email-jrdr.linux@gmail.com> <20190905185910.GS29434@bombadil.infradead.org> In-Reply-To: <20190905185910.GS29434@bombadil.infradead.org> From: Souptick Joarder Date: Fri, 6 Sep 2019 17:54:21 +0530 Message-ID: Subject: Re: [PATCH] mm/memory.c: Convert to use vmf_error() To: Matthew Wilcox Cc: Andrew Morton , Ralph Campbell , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Michal Hocko , "Aneesh Kumar K.V" , Peter Zijlstra , airlied@redhat.com, Thomas Hellstrom , Linux-MM , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 6, 2019 at 12:29 AM Matthew Wilcox wrote: > > On Fri, Sep 06, 2019 at 12:13:00AM +0530, Souptick Joarder wrote: > > +++ b/mm/memory.c > > @@ -1750,13 +1750,10 @@ static vm_fault_t __vm_insert_mixed(struct vm_area_struct *vma, > > } else { > > return insert_pfn(vma, addr, pfn, pgprot, mkwrite); > > } > > - > > - if (err == -ENOMEM) > > - return VM_FAULT_OOM; > > - if (err < 0 && err != -EBUSY) > > - return VM_FAULT_SIGBUS; > > - > > - return VM_FAULT_NOPAGE; > > + if (!err || err == -EBUSY) > > + return VM_FAULT_NOPAGE; > > + else > > + return vmf_error(err); > > } > > My plan is to convert insert_page() to return a VM_FAULT error code like > insert_pfn() does. Need to finish off the vm_insert_page() conversions > first ;-) Previously we have problem while converting vm_insert_page() to return vm_fault_t. vm_insert_page() is called from different drivers. Some of them are already converted to use vm_map_pages()/ vm_map_pages_zero(). But still we left with few users. drivers/media/usb/usbvision/usbvision-video.c#L1045 mm/vmalloc.c#L2969 These 2 can be converted with something like vm_map_vmalloc_pages(). I am working on it. Will post it in sometime. drivers/android/binder_alloc.c#L259 (have objection) drivers/infiniband/hw/efa/efa_verbs.c#L1701 drivers/infiniband/hw/mlx5/main.c#L2085 (have objection as using vm_map_pages_zero() doesn't make sense) drivers/xen/gntalloc.c#L548 (have limitation) kernel/kcov.c#L297 (have objection) net/ipv4/tcp.c#L1799 net/packet/af_packet.c#L4453 But these are the places where replacing vm_insert_page() is bit difficult/ have objection. In some cases, maintainers/ reviewers will not agree to replace vm_insert_page(). In other scenario, if we change return type of vm_insert_page() to vm_fault_t, we end up with adding few lines of conversion code from vm_fault_t to errno in drivers which is not a correct way to go with. Any suggestion, how to solve this ?