From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E3B8C07E94 for ; Fri, 4 Jun 2021 15:55:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA5FB613F1 for ; Fri, 4 Jun 2021 15:55:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA5FB613F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 578296B00A5; Fri, 4 Jun 2021 11:55:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 528316B00A7; Fri, 4 Jun 2021 11:55:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37B246B00A8; Fri, 4 Jun 2021 11:55:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 004B16B00A5 for ; Fri, 4 Jun 2021 11:55:28 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8D310180ACC5A for ; Fri, 4 Jun 2021 15:55:28 +0000 (UTC) X-FDA: 78216491136.01.8BA408A Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by imf21.hostedemail.com (Postfix) with ESMTP id 11C28E00202D for ; Fri, 4 Jun 2021 15:55:04 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id a1so5139212lfr.12 for ; Fri, 04 Jun 2021 08:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ij2m//i2vBsvWVnhGZ0XX68OI3bOnqi+sqV2qYh6ilE=; b=0a0ckhenY104NwViOzux/nsF7MNxKyTmqDt4G3pYeg6N05gBAHLJ1e167QtHn+tanr l8jqrm/IaCj4GSXMxQ7nHM6w0q/WNVAK8h4GtYe7z8y2idNAJ6tXLaOFhy/DulQj2QRp DC2B8mE+JPu3LcDhNvivHczs3p0QQc3uTbyom6kOciHY5sRoMwEdQabF5td7wcD9qonk Xj5j+SAtQaGJsFdIzhQWJuD4sPLe0Fh8ecxyF70FaMeIkknYs4EkZr8M6uaUrwZ/UbIW pVwjp69OKq4ls0OmKT4wBQzA3BoUyebi02nVubEAtu2tBtr7NWntpSkAdXhkBDt62mVS WO8w== 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=ij2m//i2vBsvWVnhGZ0XX68OI3bOnqi+sqV2qYh6ilE=; b=oY4rrH6uAMMhWvD8Fnotn2zK7xB4dAB8beIDk7larDkIUPKUaX+Pa6dBNrkDYuBopo TJOF87Kk1jwtK7CQ3qDzm0AV4ytj2uCRolOFDnOVNm0aHHkV8RL7ry1T9wqY3yW7FZAM yncS+Z8lYZAr+JkLZpqMU49ASBh+Oyf7ndPwNQQjrq0ftaztyof9YmEoZZXyqLXIYVjU /4BO8GJcOsH5kBXrmAY8/22xHkZ04hrBFiZK1CvdV7/wRps/w/1H1lxU8QKy4IQuQGvZ 6xMzIZaRNMO/rAdkITKWdns0g7UWmNDwRb/Cj/6Gqs2Gd10vasI0K2yytJEPFH6+iMzF XAhw== X-Gm-Message-State: AOAM5300ZRC0iJEG8YwGPmPcQzbfXeBleUXrEkb1QV0awy8VJ9/wtKqc trd6f+rhqv+m7KPJxLtIZYb8OfjUKQDcyA== X-Google-Smtp-Source: ABdhPJy+REWo212Wm8EnBabZxH14h5sBHwmDpzuQ7H2pjbEiesqoXy6o5AY9mSz57y/2j7sa5NNzFg== X-Received: by 2002:ac2:4899:: with SMTP id x25mr2636953lfc.372.1622820236389; Fri, 04 Jun 2021 08:23:56 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id l15sm496245ljc.35.2021.06.04.08.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 08:23:55 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id D566B1027A9; Fri, 4 Jun 2021 18:24:07 +0300 (+03) Date: Fri, 4 Jun 2021 18:24:07 +0300 From: "Kirill A. Shutemov" To: Ming Lin Cc: Linus Torvalds , Hugh Dickins , Simon Ser , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2 2/2] mm: adds NOSIGBUS extension to mmap() Message-ID: <20210604152407.ouchyfuxjvchfroe@box> References: <1622792602-40459-1-git-send-email-mlin@kernel.org> <1622792602-40459-3-git-send-email-mlin@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622792602-40459-3-git-send-email-mlin@kernel.org> X-Stat-Signature: 73htrjykhifd6s7spjufzod4b7ty74e9 X-Rspamd-Queue-Id: 11C28E00202D X-Rspamd-Server: rspam02 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=0a0ckhen; dmarc=none; spf=none (imf21.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.167.41) smtp.mailfrom=kirill@shutemov.name X-HE-Tag: 1622822104-895674 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 04, 2021 at 12:43:22AM -0700, Ming Lin wrote: > Adds new flag MAP_NOSIGBUS of mmap() to specify the behavior of > "don't SIGBUS on fault". Right now, this flag is only allowed > for private mapping. That's not what your use case asks for. SIGBUS can be generated for a number of reasons, not only on fault beyond end-of-file. vmf_error() would convert any errno, except ENOMEM to VM_FAULT_SIGBUS. Do you want to ignore -EIO or -ENOSPC? I don't think so. > For MAP_NOSIGBUS mapping, map in the zero page on read fault > or fill a freshly allocated page with zeroes on write fault. I don't like the resulting semantics: if you had a read fault beyond EOF and got zero page, you will still see zero page even if the file grows. Yes, it's allowed by POSIX for MAP_PRIVATE to get out-of-sync with the file, but it's not what users used to. It might be enough for the use case, but I would rather avoid one-user features. -- Kirill A. Shutemov