Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1065010pxa; Thu, 20 Aug 2020 01:14:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0RaodjE5mdY2mE3+0gWjGBe8J0vxR4mxJcvpAPlk8A9IXrLPKQ3ce4+Z7kbXhGpOkYbL9 X-Received: by 2002:a17:906:8748:: with SMTP id hj8mr2163561ejb.477.1597911282978; Thu, 20 Aug 2020 01:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597911282; cv=none; d=google.com; s=arc-20160816; b=PPUC2r9T1487C8x4YFcQCxaEwE9M4lerwsExtfCuoBf14z6KDku0g7SMhKZiM7gdXP 7yqG1mo7aapBRzSz+rzCy9XPHkdV63+MLmbgWkXc4Ac18sT6d0c9bZ58s6gP0+B0meEB uCynA5YiOs04WqEex/b9B1iqnIK73kMEHZQxk8TQq7bjIqhjNlM4rd4JddtgbmfM3a7a FTFbZpSoV1bhkS+hIBg2OWMkbeSPZI2kH532qvoO0pkIhgOkXYBaR5fGsFhYDkt+llJx haDHRhvtc4LdhineUtnfIVWqnjLcj2mzFhIPjmgVuvZWOEUuDFRGfGMQ9UK1fks92xKO UEVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wFUfLu1wjKpBcBk58rANEq0OhljlSviFHmqAjjNj9gA=; b=D04IhRYzD0X4kdEkDG4qW8IPz+tHkUXuZf3HdP6tk8ARvEk+5ZhOWttPcfjdJWjqJM Cr/qbhBDiBHGOATApv5W+y6IAnq+rUr9iU44e514uZ/TRS47ubPzwcNyFw32NOCvpaPH +7N8l3wvQyLT68fqPKBD7w43ZFDe364hnSYo7apXxuXu3sYm4PLBGo03xIHqTIrEHEjU eEyY3GIG6o/UPRZqzCDXq7NL1kJajDp+6D6/yb9XNFHLkz8GYFL5xphWOruJoO7PWvNY ZLD4xaspOBGUV6L9PGgxQNSN6mvFrGhu8pTuQCkN2sVzi7oXkVPyAFaJVMpjM60a1d3n 6xjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YI3WGBlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q6si948760edg.496.2020.08.20.01.14.18; Thu, 20 Aug 2020 01:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YI3WGBlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726792AbgHTINS (ORCPT + 99 others); Thu, 20 Aug 2020 04:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbgHTIMo (ORCPT ); Thu, 20 Aug 2020 04:12:44 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96D0CC061757 for ; Thu, 20 Aug 2020 01:12:44 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id r13so941187iln.0 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=aBHCTgcIQZBgveVaaaB9Vv8HNH1ph85FKmMrcuNGVywRJf6l/WfrYxaPvBJXe6a+mu ROFiIQ8XPtQE1/0XiqLnu7twoiljv7GQNOEn20OYz+Ib11WDFheHSaUBYKwii2yAaoK3 eSX7bagEh1GwOnCxXbqGs8ZzOmtWvgz5uDF0IK4cz+ppKjXucZWp68Lk1U07sDr6syad +mtTUtSd7GmIqpwSjqTWO6tk0o4PM4pBVfwl4h0itZ9+lXJqtAoolJqXXvWNFOe3h/h7 tC7OMpU+JLYnAhOGg2KFd/05o3FYpuQ9pt9D8f3r9Y/tLiSC96ShKVgOPSiSioimcddk KF7A== X-Gm-Message-State: AOAM533EIke4xc1yIcRfb3TfzibVVBvN3Gz6xV0bv9qF9mAKxSoEm2ll XBQF2zIKylY82ulglVbADx422Q== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.