Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp126452ybh; Mon, 9 Mar 2020 17:48:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuTfnlsAKw3fR7PAhxEonvOrmnZ6TXpUY+TJmxl5vY9ObgN7JnideVv/WWJrhiX+nDEmqLl X-Received: by 2002:a05:6808:b29:: with SMTP id t9mr1285876oij.64.1583801283762; Mon, 09 Mar 2020 17:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583801283; cv=none; d=google.com; s=arc-20160816; b=XcwqkkWuGQeAqkbD1GT5hiFZ+SW8bDfCTA0Ktr5/3s4yhMv1bv328Bu4Hi5DhDxNz2 ut66k8cRmO+R9jkPs+A5DpOG3vqIPAbhIvEzZ1kXSTdplAaK0vo0cc8hCTDiTmKyuqOY 0K78AK7d1prU6COPFAqIZROYXTD6peNX+f7yUlaN2ub45kjMseEkePc56SxWi0zc8Tns sHYGVRuOn7SuD9R+N+Fkv9utshg4dS3d0Y84k9D7sYmvqUQElyjPMy+1oDasm/1B2hHX EiE+KNkv0uaX5vHCQH3BMdZIXAeeex8cabRc0sdRazM5zFA2C/ZEaHbvwseS8ToGZofs 9KFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=26QsCB8W83s8I0/JuIlZZ4BURVVZW5a1bWPwo7lVEF8=; b=I7IQLexiYE+PcyK31m6bgz4l/hXU3IVrO38VhbKcwFX16Pd70PhoZiMJYA/U9vK2O8 2ODRw9Aqhyn98/qfNFy+5+PopKLYHAo8QxJaQpE8kBCpzY+QAkIrQklH+5l9zryvpiEp s4HbobI9s0jUkbDRDOzBf63exWB309yjYPvndlzDyc+5U0Yt5S3vGH01p2UBpjde41NE ywipWbcWrRrY1mrl9IHWb/mEh0EhvQImNEZNENbenoLG+a1KOBLkoTDVps0FVeER+wz5 08i4OWkB1VI9d/RJE4qSRssLAzihjlsK8WQktf0asmzPcfYC3CR2erVD8id5h3B1//m9 eIpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YEFO+g1F; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23si4611350oii.20.2020.03.09.17.47.51; Mon, 09 Mar 2020 17:48:03 -0700 (PDT) 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=@google.com header.s=20161025 header.b=YEFO+g1F; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727540AbgCJAp5 (ORCPT + 99 others); Mon, 9 Mar 2020 20:45:57 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43344 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727287AbgCJAp5 (ORCPT ); Mon, 9 Mar 2020 20:45:57 -0400 Received: by mail-pf1-f193.google.com with SMTP id c144so5622104pfb.10 for ; Mon, 09 Mar 2020 17:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=26QsCB8W83s8I0/JuIlZZ4BURVVZW5a1bWPwo7lVEF8=; b=YEFO+g1Fryj2bQJ1ggse9nsi1GsB+dcble75kP3KrLOHB2uV1mhRnz3bbx8H0KXz0K hSmZYyyRhqMvE63wtsDTtiokcjRjaM5YMUez6F1TzKTSTJfJBEklrRSR6XJa1cak/XOO lV567K0ydDBlO23NRF98f4M2Eh3T2ETgN98JNKe9BGzBnHBkuSPxtcX2opWCzulaSxom u94se0Dd9DOJ7jGkafF62sKsj3YA92lGFL4gQO15+SURUjjSxFEFt8KeEyXNST4QNT2R UoeBxtNtfYMjxnwqViEHMXPsAnfW0vTmC/LBqGRMd1zQ2miSbcJNePX95apqglmRu8bs 1M2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=26QsCB8W83s8I0/JuIlZZ4BURVVZW5a1bWPwo7lVEF8=; b=ILxoUenP441Ihfig3tvnMfH+lh8te3Gf8w/Ceeki6emwbTyhjFGAHF18CduLITlKyI RCdArD1Cw0l9ChrE0nGIDyXqSEoH7fybrbnCuheKxRnPlq2Yw62L6K6NIOwstbt24TD9 9N1gi39o5fnLRqUluwo20BE316KWYxG0ml410b8kC5qUnUUA1hd4dH1XqSNqWnxZpaVy CUb8SD8mjwK7+sbk3fwUP+sfw36F40fD8Q2svIWLeikw/4iNNaUBSdb9H+s21bj/HJ55 X6wp3qSoG3TYk+v95qIOn4XuSUFOdCnXjyDJueWZkpraxr4EbT9pCDhTbUfvnLT8jU9d CM+Q== X-Gm-Message-State: ANhLgQ0EOoovaeO4fb2F7sRoYIq+SiP4w4zMpKtCRiunthWG9qKIi8iL tNGihwWnFN58SwGfuvFM8T9fiw== X-Received: by 2002:a65:6495:: with SMTP id e21mr18198524pgv.420.1583801156413; Mon, 09 Mar 2020 17:45:56 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id g7sm650857pjl.17.2020.03.09.17.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 17:45:55 -0700 (PDT) Date: Mon, 9 Mar 2020 17:45:53 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: David Hildenbrand cc: "Huang, Ying" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , Mel Gorman , Vlastimil Babka , Zi Yan , Michal Hocko , Peter Zijlstra , Minchan Kim , Johannes Weiner , Hugh Dickins Subject: Re: [PATCH -V3] mm: Add PageLayzyFree() helper functions for MADV_FREE In-Reply-To: <23076072-7875-cabf-768f-ce27cba3480d@redhat.com> Message-ID: References: <20200309021744.1309482-1-ying.huang@intel.com> <68360241-eb18-b3d8-bf6f-4dbbed258ee6@redhat.com> <87r1y1yjll.fsf@yhuang-dev.intel.com> <23076072-7875-cabf-768f-ce27cba3480d@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Mar 2020, David Hildenbrand wrote: > >> I still prefer something like > >> > >> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > >> index fd6d4670ccc3..7538501230bd 100644 > >> --- a/include/linux/page-flags.h > >> +++ b/include/linux/page-flags.h > >> @@ -63,6 +63,10 @@ > >> * page_waitqueue(page) is a wait queue of all tasks waiting for the page > >> * to become unlocked. > >> * > >> + * PG_swapbacked used with anonymous pages (PageAnon()) indicates that a > >> + * page is backed by swap. Anonymous pages without PG_swapbacked are > >> + * pages that can be lazily freed (e.g., MADV_FREE) on demand. > >> + * > >> * PG_uptodate tells whether the page's contents is valid. When a read > >> * completes, the page becomes uptodate, unless a disk I/O error happened. > >> * > > > > Why not just send a formal patch? So Andrew can just pick anything he > > likes. I am totally OK with that. > > Because you're working on cleaning this up. > > > > >> and really don't like the use of !__PageLazyFree() instead of PageSwapBacked(). > > > > If adopted, !__PageLazyFree() should only be used in the context where > > we really want to check whether pages are freed lazily. Otherwise, > > PageSwapBacked() should be used. > > > > Yeah, and once again, personally, I don't like this approach. E.g., > ClearPageLazyFree() sets PG_swapbacked. You already have to be aware > that this is a single flag being used in the background and what the > implications are. IMHO, in no way better than the current approach. I > prefer better documentation instead. > Fully agreed.