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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 E1057C433DB for ; Fri, 12 Mar 2021 15:15:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A0D764DBA for ; Fri, 12 Mar 2021 15:15:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A0D764DBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 100CB6B0072; Fri, 12 Mar 2021 10:15:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 08BF16B0073; Fri, 12 Mar 2021 10:15:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E451E6B0074; Fri, 12 Mar 2021 10:15:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id C36666B0072 for ; Fri, 12 Mar 2021 10:15:57 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 879691802185A for ; Fri, 12 Mar 2021 15:15:57 +0000 (UTC) X-FDA: 77911572354.06.C671EFB Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id DDF786000121 for ; Fri, 12 Mar 2021 15:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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; bh=TZbwU4rf+0eEV3HDLtnE1sHMReE3RAvn8WiDnnzxRfA=; b=Gi3W6WHdXo9OgZb2UkrMZq5283 8VVxu/TKOYWbDoFWiWyQUvwoZovlhBkmmS3pJ1LuZQEHf0TlOuABokSmzgkoHy1FXcCwU3ZFg5vli yzRVVkVyIbnHhhPFC51LOd2F5dILlhpxknMK34gc5iXRWCzhsfIt4cY9K27UmlYFuUZQj8GGmZ/lA Og/hFEW301wvax2yTpFI225EhsY1ktblr+XhJ/eMuzmDNPDTJluO37H5WtEaiRj7tlux7CYHXhO+A vK3TNz/dqsDjRQFCl6PgZPdS5UYyTKtgtQ73Csf4pnuhAfGCSkCjrFkjpHBxwHHJZEmKJrs7tb/Yp SiFvW4GA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lKjVs-00Axi5-Gq; Fri, 12 Mar 2021 15:15:43 +0000 Date: Fri, 12 Mar 2021 15:15:40 +0000 From: Matthew Wilcox To: Peter Weber Cc: linux-mm@kvack.org Subject: Re: Is anonymous memory part of the page cache on Linux? Message-ID: <20210312151540.GC2577561@casper.infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: r1x8awf45jxjkoxhwp85bjy6finq4a36 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: DDF786000121 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615562154-618381 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, Mar 12, 2021 at 03:43:33PM +0100, Peter Weber wrote: > Hello! > Hopefully I'm asking here in the right place and don't disturb. > > Is anonymous memory - i.e. program heap and stack - part of the page cache > on Linux? The documentation[1] of the kernel does not state that. But the > Wikipedia entry about page cache contains a graphic[2] (look at the top > right) which gives me the impression that 'malloc()' allocates dynamic > memory within the page cache. The wikipedia diagram is wrong. Anonymous memory is not handled by the page cache. Anonymous pages enter the storage stack via swap; they are found in the page tables, sent to the swap cache and then written to swap devices or swap files. Filesystems may get involved at that point, but not always. There are other weird things in the wikipedia diagram, like Direct I/O being seemingly detached from applications, and not appearing to pass through the VFS.