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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E12F0D2E9F0 for ; Mon, 11 Nov 2024 14:08:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04B656B007B; Mon, 11 Nov 2024 09:08:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3DC16B0083; Mon, 11 Nov 2024 09:08:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E059E6B0085; Mon, 11 Nov 2024 09:08:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C1BD76B007B for ; Mon, 11 Nov 2024 09:08:38 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3B478AACC3 for ; Mon, 11 Nov 2024 14:08:38 +0000 (UTC) X-FDA: 82773992616.07.CFE5C07 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) by imf20.hostedemail.com (Postfix) with ESMTP id 815791C0012 for ; Mon, 11 Nov 2024 14:07:45 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=R4Y3e9rR; spf=pass (imf20.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.50 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731333924; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PmDn4fmT+hcwgS51qhVcBXpxC2DgB/s2ZMPiu9nNnjA=; b=KiYELgPvk8SGm3WexwYPXx2UkmxxxrzR18nbSWmnqSNFm/vpXp3i1BTzEiXmbY9SajDjDa tzG01pj+NeG1+fut/Ebf62f2GEym/sMp2nYEIEX9vCsfaYY4GDQS1P5BwdRRG7D5L3lcUv Z4rl30hlEPus6DYxFDqWEzdhJraM8U8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=R4Y3e9rR; spf=pass (imf20.hostedemail.com: domain of axboe@kernel.dk designates 209.85.160.50 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731333924; a=rsa-sha256; cv=none; b=mwCh1xNTNqEakG03H/JzUXwoIYLg/xHSxiGFVAmIfP5n0drvf/3pTTCXZFjVPnTAJ5+h7d qrOUBUQBF/eQ1CXqtf6+lLmFU8E2fkXnor2Bb1Fj+upPP2bUts8K4JfvB2kkzdww16y6B3 +gkwwARfMDkHoDDUWNF7/XzLthIygYI= Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-288b392b8daso2060387fac.2 for ; Mon, 11 Nov 2024 06:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731334115; x=1731938915; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PmDn4fmT+hcwgS51qhVcBXpxC2DgB/s2ZMPiu9nNnjA=; b=R4Y3e9rRf8vk89M6HvAVm7NA4yj8AkiBqFDtsQUe+5YL138XVsyHqIBYyjJc4M5LF7 vD636UAijyk0jTNhunHihPvJezAzSxxFFydqqXg/UM3McV7xYxNmzNPiaZzUEF1ZhWDi T40cetzbEBNMnrITCpsfCDNogND/HytD3c+HPpnMAFKjpRB+N/e+XOb/2aP4xdfp+/qF 5IBPDyoJ4DDWKw26oBvKckv0a+VrWW+LIRMWymbIBO5PQmZfNru71HiagxfTGmuvuK5o 4VpnJozu0QE7NK4e6TVNqj4uCWUpg+VXy+jIP62duGE3R8pcrB24wkgz/vGhwriHtxUx tDHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731334115; x=1731938915; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PmDn4fmT+hcwgS51qhVcBXpxC2DgB/s2ZMPiu9nNnjA=; b=ZS5SgI/8jo8VUmhmO9qMl4p9TNJVCivK5EJwD8z887BIg/qfAMgprYy6pcG4DGh4pn yqcrqrkfHrLKNMFIADr6wSqQZp/lMquvRc4MAFHckfwY/CemlQzpI9x1Z2ZNjP6eLWWU O+d3R/A1i1bsBVlMqgzs1v467Ko0So33Ghpy4JZPPXDrokZpOBKv5mjkyDI81Gy9Bcv9 Io8SdOWD/iz8o2HZeUkDV6iuyBLDH5HQqA23kA9ZmHyaIHVd4rwB13HH+LkSeZ9o6gIM Zlr+BoxpNTCdxwxMGVmjegNtglyOAcewN6ws1hmmP3WiRt6psbofQN6Z465YRePuEE68 tSMg== X-Forwarded-Encrypted: i=1; AJvYcCWypBp5WThqSxCWD8GE3GX+heJ7jad+t0z01XI2XQA7GDG7kOdChW4vJ5W12d1KZWFr7LSBzR+4Iw==@kvack.org X-Gm-Message-State: AOJu0Yw9LkW6rnt7DLd6PRmW1n7LV4XK0O4kJMquvs5FvepIwQ6E2JLP VWWuUFB3oWk75moMHCqmuEAby3Zkhwe+he42JcCZt+xH2Y1TtEXT6LsJLYS4Mwk= X-Google-Smtp-Source: AGHT+IGdcCxlTJ6oOmUoz2nOosPJA727x85N6SHkCMBCewWNWdgUVALhVXS8gvGZ6CBRqRCpqZFcAw== X-Received: by 2002:a05:6870:e6c6:b0:25d:f0ba:eab7 with SMTP id 586e51a60fabf-295600bf475mr10068218fac.18.1731334114914; Mon, 11 Nov 2024 06:08:34 -0800 (PST) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29546eddb89sm2817619fac.34.2024.11.11.06.08.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Nov 2024 06:08:33 -0800 (PST) Message-ID: <00c51f80-7033-44a0-b007-ca36842e35a5@kernel.dk> Date: Mon, 11 Nov 2024 07:08:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHSET v4] Uncached buffered IO To: Stefan Metzmacher , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org References: <20241108174505.1214230-1-axboe@kernel.dk> <63af3bba-c824-4b2c-a670-6329eeb232aa@samba.org> Content-Language: en-US From: Jens Axboe In-Reply-To: <63af3bba-c824-4b2c-a670-6329eeb232aa@samba.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 815791C0012 X-Stat-Signature: 8c3sg84eh8a5ndkicng9pbcjntck9zwa X-Rspam-User: X-HE-Tag: 1731334065-744149 X-HE-Meta: U2FsdGVkX18kLTOEdggxQRwCorPwrxQRA4sjrNxuzuXSMgsf/uWLsDKWi+tYpZpDotLZxi3xSm6rAx78UvdwoVk+JyxT8fShQQ8mmvqIomWDY9ew+pvB5ERIWJ23ZQJyNUMbc7J5IHne1JznrKymO3KBOrCPfVbsPq2xqUAKyzAM3rYoRlXEZDmDnJtp43liYXjCkv1JhlvW+HjVQTSN4Db6JDkduumoB0Y2b+5qPG0xddU/18a40kywJD53tBIA0lYae1RAmwPY5ufv6PDJl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sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 11/11/24 5:55 AM, Stefan Metzmacher wrote: > Hi Jens, > > I'm wondering about the impact on memory mapped files. > > Let's say one (or more) process(es) called mmap on a file in order to > use the content of the file as persistent shared memory. > As far as I understand pages from the page cache are used for this. > > Now another process uses RWF_UNCACHED for a read of the same file. > What happens if the pages are removed from the page cache? > Or is the removal deferred based on some refcount? For mmap, if a given page isn't in page cache, it'll get faulted in. Should be fine to have mmap and uncached IO co-exist. If an uncached read IO instantiates a page, it'll get reaped when the data has been copied. If an uncached IO hits an already existing page (eg mmap faulted it in), then it won't get touched. Same thing happens with mixing buffered and uncached IO. The latter will only reap parts it instantiated to satisfy the operation. That doesn't matter in terms of data integrity, only in terms of the policy of uncached leaving things alone it didn't create to satisfy the operation. This is really no different than say using mmap and evicting pages, they will just get faulted in if needed. -- Jens Axboe