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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 884BACFC29F for ; Fri, 21 Nov 2025 19:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MxF59WmVC94ekHWWfmOvhaVMM4faP7EzRMfmAqFTuMg=; b=JEFZA1wZWbLpI8zalozEc3LkYW IZ0np494b3qRVHXGc8QROHtctyOCfxg885oUMjy3dP0yYPz+lu+kcYNeyfzhuGJtaNjkMUR1EpQO5 E/uWfPKPjj41tjd22LQjZYZPQ9V1zxLHQ8I7JUvtI+lyOYBfaKVmVxCnXI8FVjeY8rrY=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vMXB2-0004qi-JM; Fri, 21 Nov 2025 19:52:16 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vMXB1-0004qb-IO for linux-f2fs-devel@lists.sourceforge.net; Fri, 21 Nov 2025 19:52:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=P/rZyNC4jIKdyCIN0gURHOpJAFoyFBeumXWclaPygqA=; b=HbKWg2dF1ZFeYpPVb/CdAiYUKe z7aaQsyFoHd8UhBuJ2Y8OnvmJAC+bDnFlbuIx4C1MKxGDthCd6PGhzzhk6fKQeQujnDtsgrdGyE0Q IGEdo0mMZAUdWWI4aWcwVsfID5Z8Mk3HHVCtBJa8krP0HZUvZVopH+yLeTvICUPegJsY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=P/rZyNC4jIKdyCIN0gURHOpJAFoyFBeumXWclaPygqA=; b=SJYTF27DAOBwnFqDGrcd/xQeJt js2lID1/F5LtAxtQIUX1Mmp9OCH1lgsFzq4W9SNftWNg58ecFyOsQHTzKMrsSBLL+NN9GZyNM+VWT 0PeNlrzTTmgikbCGS1XA4QFUvuXiV6FzPOTWJvKvymlkHitRcssGqsNGAjdmvYvN0KjA=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vMXB1-0008Ri-5E for linux-f2fs-devel@lists.sourceforge.net; Fri, 21 Nov 2025 19:52:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 76D2C60145; Fri, 21 Nov 2025 19:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6357C4CEF1; Fri, 21 Nov 2025 19:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763754724; bh=xfWX1MWedHrZ+OmxiBiUepfssMh2KX6vp847cJtltI0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aubBZ50KhxASUsH9f7p2KYtdywmckKytFFSSMWN+M5kMVpFoQmf3P4Ll2z6Ii6ahD jG2YRwfA3fQkhEJbTys06AsOkQrHf74rUejklOCu09/ZdYUehGJjUhCqugC2yKWJSN r07RDzlrwhVteEJ4/URMg+cbxlywBcP2lQBX0HphCs1Rkkn6j9niIQzKe+qY8iJT1l xywqK7xYvLZj/JqUhjCAnmxcJADcEfFobBHy1Yl4dt0mLRE01rmnRjqjNm+WYFG7bV Wlhx0osTVfe080ht8Bgj+FbxpSeombfsqFW9P4kffbHMO1Z3sBoAvuKiqoS4HxlDdp NIX1jQ3UkAK4Q== Date: Fri, 21 Nov 2025 19:52:02 +0000 To: Matthew Wilcox Message-ID: References: <20251121032718.1993528-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1vMXB1-0008Ri-5E Subject: Re: [f2fs-dev] [PATCH] [RFC] mm/fadvise: introduce POSIX_FADV_MLOCK X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jaegeuk Kim via Linux-f2fs-devel Reply-To: Jaegeuk Kim Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 11/21, Jaegeuk Kim wrote: > On 11/21, Matthew Wilcox wrote: > > On Fri, Nov 21, 2025 at 04:46:14AM +0000, Jaegeuk Kim wrote: > > > On 11/21, Matthew Wilcox wrote: > > > > On Fri, Nov 21, 2025 at 03:27:18AM +0000, Jaegeuk Kim wrote: > > > > > This patch introduces a new POSIX_FADV_MLOCK which 1) invalidates the range of > > > > > cached pages, 2) sets the mapping as inaccessible, 3) POSIX_FADV_WILLNEED loads > > > > > pages directly to the inaccessible mapping. > > > > > > > > ... what? > > > > > > > > This seems like something which is completely different from mlock(). > > > > So it needs a different name. > > > > > > > > But I don't understand the point of this, whatever it's called. Need > > > > more information. > > > > > > So, the sequence that I'd like to optimize is mmap(MAP_POPULATE) followed > > > by mlock(). For example, mmap() takes 1 second to load 4GB data, and mlock() > > > takes 330ms additionally in order to migrate all the pages into inaccessible > > > map, IIUC. > > > > Oh, so the MLOCK part is right, but the inaccessible() part is wrong. > > Inaccessible is special weird guest_memfd crap that has all kinds of > > side-effects that you don't want. > > > > Wouldn't you get the same effect by calling mlock2(MLOCK_ONFAULT) and > > then calling readahead() for the desired range? > > Oh, thank you. Let me try. After checking the code and experiment, I don't think that gives what we need. That flag skips populate_vma_page_range only, but we need to allocate pages in the inaccessible mapping and fill the pages afterwards. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A104B279DCE for ; Fri, 21 Nov 2025 19:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763754724; cv=none; b=bXc7TFiXQGr2gK9ifuXNtAAg1bUDdDU38I/hV+gnS07CZyPoP/fkd9EXtS4SwpPZ4uUZA9Q98IrIaAg3aia68SvLI990OgvpKXhK7jocsu0cbON34HLDuvK0sSTVPZxXfCvt6QgOKFz5Cqjk7hk9/T6v7UiXuYszWRJX8acwaDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763754724; c=relaxed/simple; bh=xfWX1MWedHrZ+OmxiBiUepfssMh2KX6vp847cJtltI0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pVMnGgnVvUohGH+PmErRouw+FysXcF2SLq6xEInOQVu5/RYUXVqrJBI99TQLH9Q9bRLVIRbcObq9gSPwNnAgiZBPJbJ7vjo+65vnOf/VBRLqsKIN54qHtZHxolzaT3OOWNFpVlwizXLwsS2SimU5jZ/xROXbJx8dT1r0tPz8WtA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aubBZ50K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aubBZ50K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6357C4CEF1; Fri, 21 Nov 2025 19:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763754724; bh=xfWX1MWedHrZ+OmxiBiUepfssMh2KX6vp847cJtltI0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aubBZ50KhxASUsH9f7p2KYtdywmckKytFFSSMWN+M5kMVpFoQmf3P4Ll2z6Ii6ahD jG2YRwfA3fQkhEJbTys06AsOkQrHf74rUejklOCu09/ZdYUehGJjUhCqugC2yKWJSN r07RDzlrwhVteEJ4/URMg+cbxlywBcP2lQBX0HphCs1Rkkn6j9niIQzKe+qY8iJT1l xywqK7xYvLZj/JqUhjCAnmxcJADcEfFobBHy1Yl4dt0mLRE01rmnRjqjNm+WYFG7bV Wlhx0osTVfe080ht8Bgj+FbxpSeombfsqFW9P4kffbHMO1Z3sBoAvuKiqoS4HxlDdp NIX1jQ3UkAK4Q== Date: Fri, 21 Nov 2025 19:52:02 +0000 From: Jaegeuk Kim To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Christian Brauner Subject: Re: [PATCH] [RFC] mm/fadvise: introduce POSIX_FADV_MLOCK Message-ID: References: <20251121032718.1993528-1-jaegeuk@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On 11/21, Jaegeuk Kim wrote: > On 11/21, Matthew Wilcox wrote: > > On Fri, Nov 21, 2025 at 04:46:14AM +0000, Jaegeuk Kim wrote: > > > On 11/21, Matthew Wilcox wrote: > > > > On Fri, Nov 21, 2025 at 03:27:18AM +0000, Jaegeuk Kim wrote: > > > > > This patch introduces a new POSIX_FADV_MLOCK which 1) invalidates the range of > > > > > cached pages, 2) sets the mapping as inaccessible, 3) POSIX_FADV_WILLNEED loads > > > > > pages directly to the inaccessible mapping. > > > > > > > > ... what? > > > > > > > > This seems like something which is completely different from mlock(). > > > > So it needs a different name. > > > > > > > > But I don't understand the point of this, whatever it's called. Need > > > > more information. > > > > > > So, the sequence that I'd like to optimize is mmap(MAP_POPULATE) followed > > > by mlock(). For example, mmap() takes 1 second to load 4GB data, and mlock() > > > takes 330ms additionally in order to migrate all the pages into inaccessible > > > map, IIUC. > > > > Oh, so the MLOCK part is right, but the inaccessible() part is wrong. > > Inaccessible is special weird guest_memfd crap that has all kinds of > > side-effects that you don't want. > > > > Wouldn't you get the same effect by calling mlock2(MLOCK_ONFAULT) and > > then calling readahead() for the desired range? > > Oh, thank you. Let me try. After checking the code and experiment, I don't think that gives what we need. That flag skips populate_vma_page_range only, but we need to allocate pages in the inaccessible mapping and fill the pages afterwards.