Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6864555rwb; Wed, 18 Jan 2023 10:16:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuIF3fx2RCESG/JCpJoPCY+jzIdMzueNcAhwJZ3z6SuhmnkucPbciBM9tXzeLOVeECObbsj X-Received: by 2002:a17:902:7c94:b0:194:67e1:c85a with SMTP id y20-20020a1709027c9400b0019467e1c85amr8051549pll.16.1674065780486; Wed, 18 Jan 2023 10:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674065780; cv=none; d=google.com; s=arc-20160816; b=GTIEs+EKhS8P9PNSziBrLMvEQ3t+hrpLo19wNbHiWfvSYyY89XSdDbVDZTys2aAipZ tanMDs4VafJMbmfV3IAi5sGsiIz/L6PjP8ciClP1gIA9tSX7DPm2c2FrQTlCI32v52vx /KK9olAA7IEYQj2yDUuOh3d/FKjODOoTIXwr+KYiDetozGjZmiEGmAwTHtplTY5gr6jZ AId/kl0wLVS+1M1SR98e27HCfI3WEnCo9DujRUV4ruutwNe/AyVBZg0IUc9fOqpxbkEe e1KzL1i+GNFspfNMYukqLhBnZnGvOHg8GBQUFW1JBlY/STg/KY2DY0pZMEPVa0IkEjVf pEwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9dTFMymlDr17UYhbPp036QZqSTFRCafyAkKJXNbb0xw=; b=QMDww3fp1oAlC67S7z1nRZmNdUQNJYw5Fm6EM6KHbi7Ulh9g81OdIgitdQCSg7hewm elt5s5IUrW/kPoGYun9bxfkKfmkH+DLw783M6fEG9FzPsUXU2pXRAaALoojrsbtmJ1Nc HJv/tVIKe5GE3NC0aIx9A/4zUaGzoBB+pH54DWONwa/bxpN6ILnz096QLpKYe/+nI2El a9FH0BbEiyf0pgulNTBVT2ukWtk9r4q47cAiQ27RVjer6bnOtUri//x0CE22AbVnH4aP 2Ln9wVz++0Zpn93k23ff9oMBvbUoAr4Rk44neTZqwrhTbDjkY0EfihBRPwqDObyWd7a6 fSdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HTjXGuKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a63e507000000b004b2c5ff33d5si30118215pgh.58.2023.01.18.10.16.14; Wed, 18 Jan 2023 10:16:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HTjXGuKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbjARRfh (ORCPT + 45 others); Wed, 18 Jan 2023 12:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjARRff (ORCPT ); Wed, 18 Jan 2023 12:35:35 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A214B21A0D for ; Wed, 18 Jan 2023 09:35:34 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5F9FC5BDD4; Wed, 18 Jan 2023 17:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674063333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9dTFMymlDr17UYhbPp036QZqSTFRCafyAkKJXNbb0xw=; b=HTjXGuKHZru2DgZY/SxOVxG7oEcG+BxiuvyBhCi8Hdefg4E401bxcTxKhZrzUh7dkjoxAn dQjOLkAUNwcq1syJ2t7jSwda3rGdJMSf93HmTVOlHLri3QJYfQV0/kgkSnp9rLSTRNBgMz elTJnOya0QOGJn3wBadaDBCFuL6lZqo= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3FECF139D2; Wed, 18 Jan 2023 17:35:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id o51MDeUtyGMBTQAAMHmgww (envelope-from ); Wed, 18 Jan 2023 17:35:33 +0000 Date: Wed, 18 Jan 2023 18:35:32 +0100 From: Michal Hocko To: Minchan Kim Cc: Andrew Morton , Suren Baghdasaryan , Matthew Wilcox , linux-mm , LKML , SeongJae Park Subject: Re: [PATCH 1/3] mm: return the number of pages successfully paged out Message-ID: References: <20230117231632.2734737-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 18-01-23 09:09:36, Minchan Kim wrote: > On Wed, Jan 18, 2023 at 10:10:44AM +0100, Michal Hocko wrote: > > On Tue 17-01-23 15:16:30, Minchan Kim wrote: > > > The reclaim_pages MADV_PAGEOUT uses needs to return the number of > > > pages paged-out successfully, not only the number of reclaimed pages > > > in the operation because those pages paged-out successfully will be > > > reclaimed easily at the memory pressure due to asynchronous writeback > > > rotation(i.e., PG_reclaim with folio_rotate_reclaimable). > > > > > > This patch renames the reclaim_pages with paging_out(with hope that > > > it's clear from operation point of view) and then adds a additional > > > stat in reclaim_stat to represent the number of paged-out but kept > > > in the memory for rotation on writeback completion. > > > > > > With that stat, madvise_pageout can know how many pages were paged-out > > > successfully as well as reclaimed. The return value will be used for > > > statistics in next patch. > > > > I really fail to see the reson for the rename and paging_out doesn't > > even make much sense as a name TBH. > > Currently, what we are doing to reclaim memory is > > reclaim_folio_list > shrink_folio_list > if (folio_mapped(folio)) > try_to_unmap(folio) > > if (folio_test_dirty(folio)) > pageout > > Based on the structure, pageout is just one of way to reclaim memory. > > With MADV_PAGEOUT, what user want to know how many pages > were paged out as they requested(from userspace PoV, how many times > pages fault happens in future accesses), not the number of reclaimed > pages shrink_folio_list returns currently. > > In the sense, I wanted to distinguish between reclaim and pageout. But MADV_PAGEOUT is documented to trigger memory reclaim in general not a pageout. Let me quote from the man page : Reclaim a given range of pages. This is done to free up memory occupied : by these pages. Sure anonymous pages can be paged out to the swap storage but with the upcomming multi-tiering it can be also "paged out" to a lower tier. All that leads to freeing up memory that is currently mapped by that address range. Anyway, what do you actually meen by distinguishing between reclaim and pageout. Aren't those just two names for the same thing? -- Michal Hocko SUSE Labs