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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 AE61FC433E3 for ; Thu, 20 Aug 2020 08:12:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43E4521744 for ; Thu, 20 Aug 2020 08:12:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YI3WGBlj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43E4521744 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7F7136B0006; Thu, 20 Aug 2020 04:12:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A7988D0003; Thu, 20 Aug 2020 04:12:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 697116B0008; Thu, 20 Aug 2020 04:12:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 5577F6B0006 for ; Thu, 20 Aug 2020 04:12:45 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0A894181AEF00 for ; Thu, 20 Aug 2020 08:12:45 +0000 (UTC) X-FDA: 77170230690.15.hill30_080098c2702f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id C8CBF1814B0C1 for ; Thu, 20 Aug 2020 08:12:44 +0000 (UTC) X-HE-Tag: hill30_080098c2702f X-Filterd-Recvd-Size: 4892 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 20 Aug 2020 08:12:44 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id k4so885048ilr.12 for ; Thu, 20 Aug 2020 01:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wFUfLu1wjKpBcBk58rANEq0OhljlSviFHmqAjjNj9gA=; b=YI3WGBljcqmJjBpWibWaA1B3PdJw1iIoruN9qxmTnnOwEnMPvjd8UrydeCNmL1LGO9 2CWeQFOt7O5NJgOlte+c26lUQGofhonJ9wgiZZyh22da0Idj1QgvGnPm56HPpKerw8RN CbsDUcyZ6DOOYjYKjeLIoOk/W7nwe73sAVTWWNHzypZky90EveXh9IIdse94xbAd9aqs AmxjFUZK/1dpqCJNq9aFxv8/fRipPVX0D+iZteyeOAVyj0KL0B1qEKDSkWjSWtf7gttZ kjttykSDilJzpT4rHIbLKC28g68kIpugSzXYre7+RF7FeHdVtjLOUXUiO0aJwnvLTrTs VAEw== 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=wFUfLu1wjKpBcBk58rANEq0OhljlSviFHmqAjjNj9gA=; b=e4xpfmIchPPK9Wu9uGE8d2hRlmEmxtj6n7BRHI/D4GFXGCGaARSFMkGTakL6/Ir4CG xTpEKxooEnCM456e79QQELsd+z8g6xIwWVbI6Sw7JgpPiLqjGooeLkgueyJBonAxqyl+ BFwQx/8tjw6OkX6//HA3VwfHdYD7W+8l+PDH+cfrG+J/Qd2y3n8LeYeYH4wDuuNxxthI ttvJelNHyfe8uxOZZrKOdbaz5Fe+WNfz9jvXcnbJw4srjye9yGGqRW2fL4m4dMywIm7Z KlxMz0fFOAUVyOzZndcMZHKmYaFa5IvC1wKYCjyXtsVkH2Jp4nvjOJMTFyd1cjSHNaSL 0jEA== X-Gm-Message-State: AOAM532ilqtg+hqVsRwR2M9KSS2+jS0zUbmzMKvvKZCx8ytymTNHKWJk Kj4wDaCSngifNk6PViz78HljfA== X-Google-Smtp-Source: ABdhPJw2SI8b0KzEmhQCtckhElBztVNQOXgYYM311s7TbnGafxbeEmNS2ZxuwtamEQox7CCHEQAC/A== X-Received: by 2002:a92:35da:: with SMTP id c87mr1611116ilf.61.1597911163628; Thu, 20 Aug 2020 01:12:43 -0700 (PDT) Received: from google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) by smtp.gmail.com with ESMTPSA id c24sm990383iom.46.2020.08.20.01.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 01:12:42 -0700 (PDT) Date: Thu, 20 Aug 2020 02:12:38 -0600 From: Yu Zhao To: Michal Hocko Cc: Andrew Morton , Alexander Duyck , Huang Ying , David Hildenbrand , Yang Shi , Qian Cai , Mel Gorman , Nicholas Piggin , =?iso-8859-1?B?Suly9G1l?= Glisse , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim Subject: Re: [PATCH v2 3/3] mm: remove superfluous __ClearPageWaiters() Message-ID: <20200820081238.GA2576494@google.com> References: <20200818184704.3625199-1-yuzhao@google.com> <20200818184704.3625199-3-yuzhao@google.com> <20200820061652.GX5422@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200820061652.GX5422@dhcp22.suse.cz> X-Rspamd-Queue-Id: C8CBF1814B0C1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Thu, Aug 20, 2020 at 08:18:27AM +0200, Michal Hocko wrote: > On Tue 18-08-20 12:47:04, Yu Zhao wrote: > > Presumably __ClearPageWaiters() was added to follow the previously > > removed __ClearPageActive() pattern. > > I do not think so. Please have a look at 62906027091f ("mm: add > PageWaiters indicating tasks are waiting for a page bit") and a > discussion when the patch has been proposed. Sorry I do not have a link > handy but I do remember that the handling was quite subtle. > > > Only flags that are in PAGE_FLAGS_CHECK_AT_FREE needs to be properly > > cleared because otherwise we think there may be some kind of leak. > > PG_waiters is not one of those flags and leaving the clearing to > > PAGE_FLAGS_CHECK_AT_PREP is more appropriate. > > What is the point of this patch in the first place? Page waiters is > quite subtle and I wouldn't touch it without having a very good reason. I appreciate your caution. And I just studied the history [1] (I admit this is something I should have done beforehand), and didn't find any discussion on __ClearPageWaiters() specifically. So I would ask why it was added originally. I was hoping Nicholas could help us. [1] https://lore.kernel.org/lkml/20161225030030.23219-3-npiggin@gmail.com/ Given its triviality, I can't argue how useful this patch is. So I'll go with how evident it is: we are removing __ClearPageWaiters() from paths where pages have no references left -- they can't have any waiters or be on any wait queues.