Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1242700imu; Wed, 16 Jan 2019 15:31:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN6lJqoZxGwlte06FnNxVvPwtSPh2FRQgnSvWHzYSgpHPj2lREsKZTX/v46uDg2ebaaKxwHx X-Received: by 2002:a62:1d4c:: with SMTP id d73mr12563477pfd.90.1547681492175; Wed, 16 Jan 2019 15:31:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547681492; cv=none; d=google.com; s=arc-20160816; b=UCvTqMQ1JDqWZjV0ceJxZdLVVbkgKF4Km3XWzVXVk/Kn6hWuOgT0iTnh7Ka4jZG7eB f7kAPNOhBglEpi/OI+Z60+h0Y4cOgeF/N3vcmOszlJ1+1lQrpN/uYj73hnFAMizlvWbF yXdRHH8yilL5t/JbXurAshT13thUtDEfvXfTv2NTdOhdrFtkW+IJ6JbB9TlRTghLKoiH stizOd3x1yWAYNzZu7XBv1oBDo/2H42tblidYDG61I7padKcESXXkG8o56nPE0lmVOD2 xFFXrjm7x775K92mQuSL1xrS7vdAMH7A9O9P2OT7GOK32W7Dm+ykLwhrviOClCMbbZMZ iqkQ== 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=W+afB5wbNUEIen7GSS/LHpIEPOpjXFQl9X924ccGuhY=; b=q+QNbHfFpzWqKHwlg5SHaUr5dScIhLT/lzq7yPtoKzqbq40blj3mEs52OH7CTP7T9t FLZAmxkuV7RuB5n9X61KwwLtINTQcg3eYaGRzzA/EZCByxOV26V1koMEszVCy5h3VDPt fYrqlOTf3SoUcu7XUzWmI95feQ6i/50bxFjPlcAcr6KPiU+BBYIoLPSFJh/IP6PfDUHZ GMTJJpCKOuK15iJSxU4H7ehjmmItsSBRfEkVWufmAXjZc01SQwMocAUXfytNcT7z3h4m 4/XoAXoBaPguaxRBBT3A4ti41+T5yFmNkFhu51t8pmHlvSMHAKuM5ysellZjrtq6iLpd 5GIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=W0lskNPy; 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 y2si7065848pgl.148.2019.01.16.15.31.13; Wed, 16 Jan 2019 15:31:32 -0800 (PST) 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=@linux-foundation.org header.s=google header.b=W0lskNPy; 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 S1727581AbfAPRs6 (ORCPT + 99 others); Wed, 16 Jan 2019 12:48:58 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37436 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbfAPRs6 (ORCPT ); Wed, 16 Jan 2019 12:48:58 -0500 Received: by mail-lf1-f67.google.com with SMTP id y11so5603264lfj.4 for ; Wed, 16 Jan 2019 09:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W+afB5wbNUEIen7GSS/LHpIEPOpjXFQl9X924ccGuhY=; b=W0lskNPyJGVkwBeCqn7hxuizmoco3Z9p/QtYyRASYKeE5U8WBWejOPMFzYf4XqcQKc CP9fTDmdGtWxjB6zod0u9NLNp3tceCfoA1fw/tnTdrduhvigUBxQsJOFBwlUqkIkldn1 55/K5Ik7gtG5I9h5xV1/dC1/binLkK6pUsqtQ= 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=W+afB5wbNUEIen7GSS/LHpIEPOpjXFQl9X924ccGuhY=; b=qZCLwToD1klWi1z3UonJgMuomTaCTxr9gv9tidRLYQUNBtC7feRrh/WEokZMSkPn1y mDqjyH/gKMe+re0cO1QXtbwQTiCPLBqcUcn+wlii/RHG8rTMZRaQGXLFBSCF04WZOb7Z Js7KxuqZHuwsu8u2uocW8bnEnIMPnLFX9E123ZA1WQMuuBIm+K5rFcNml9WFT1krdUiN l++ldS2X+yzJU5z230p5ogAUMtbOb8a9W+EyY54kmnZcsO0PfgN4pjoW8qS7VvN8MJqs 0eAGygae2qGVoEee8s90jLfrICUA8LG8D2SaeAGycjiIW1DpYERhw+LFWsvFD/8f6yrM 7lIQ== X-Gm-Message-State: AJcUukeI63XUUuXm++/EbnG6Mpy1hY3XGdPC/HBtfC1rTrQwfiORVry9 Jv+W/ZWpIHYaiT51FLoHLcENF7K1sUQ= X-Received: by 2002:a19:c413:: with SMTP id u19mr7652506lff.100.1547660935733; Wed, 16 Jan 2019 09:48:55 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id s62sm1314469lfg.34.2019.01.16.09.48.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 09:48:52 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id a16so5594092lfg.3 for ; Wed, 16 Jan 2019 09:48:51 -0800 (PST) X-Received: by 2002:a19:6e0b:: with SMTP id j11mr8122372lfc.124.1547660931486; Wed, 16 Jan 2019 09:48:51 -0800 (PST) MIME-Version: 1.0 References: <20190110004424.GH27534@dastard> <20190110070355.GJ27534@dastard> <20190110122442.GA21216@nautica> <5c3e7de6.1c69fb81.4aebb.3fec@mx.google.com> <9E337EA6-7CDA-457B-96C6-E91F83742587@amacapital.net> <20190116054613.GA11670@nautica> In-Reply-To: From: Linus Torvalds Date: Thu, 17 Jan 2019 05:48:33 +1200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Jiri Kosina Cc: Dominique Martinet , Andy Lutomirski , Josh Snyder , Dave Chinner , Matthew Wilcox , Jann Horn , Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , Linux-MM , kernel list , Linux API 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 Thu, Jan 17, 2019 at 4:12 AM Jiri Kosina wrote: > > So that seems to deal with mincore() in a reasonable way indeed. > > It doesn't unfortunately really solve the preadv2(RWF_NOWAIT), nor does it > provide any good answer what to do about it, does it? As I suggested earlier in the thread, the fix for RWF_NOWAIT might be to just move the test down to after readahead. We could/should be smarter than this,but it *might* be as simple as just diff --git a/mm/filemap.c b/mm/filemap.c index 9f5e323e883e..7bcdd36e629d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2075,8 +2075,6 @@ static ssize_t generic_file_buffered_read( page = find_get_page(mapping, index); if (!page) { - if (iocb->ki_flags & IOCB_NOWAIT) - goto would_block; page_cache_sync_readahead(mapping, ra, filp, index, last_index - index); which starts readahead even if IOCB_NOWAIT is set and will then test IOCB_NOWAIT _later_ and not actually wait for it. Linus