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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 931EEC43603 for ; Wed, 18 Dec 2019 07:31:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FFB524679 for ; Wed, 18 Dec 2019 07:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbfLRHbo (ORCPT ); Wed, 18 Dec 2019 02:31:44 -0500 Received: from outbound-smtp38.blacknight.com ([46.22.139.221]:52833 "EHLO outbound-smtp38.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbfLRHbo (ORCPT ); Wed, 18 Dec 2019 02:31:44 -0500 Received: from mail.blacknight.com (unknown [81.17.255.152]) by outbound-smtp38.blacknight.com (Postfix) with ESMTPS id 846A3DCA for ; Wed, 18 Dec 2019 07:31:42 +0000 (GMT) Received: (qmail 21674 invoked from network); 18 Dec 2019 07:31:42 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.18.57]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 18 Dec 2019 07:31:42 -0000 Date: Wed, 18 Dec 2019 07:31:39 +0000 From: Mel Gorman To: Alexander Duyck Cc: Nitesh Narayan Lal , Alexander Duyck , kvm@vger.kernel.org, mst@redhat.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, yang.zhang.wz@gmail.com, konrad.wilk@oracle.com, david@redhat.com, pagupta@redhat.com, riel@surriel.com, lcapitulino@redhat.com, dave.hansen@intel.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, osalvador@suse.de Subject: Re: [PATCH v15 4/7] mm: Introduce Reported pages Message-ID: <20191218073139.GE3178@techsingularity.net> References: <20191205161928.19548.41654.stgit@localhost.localdomain> <20191205162238.19548.68238.stgit@localhost.localdomain> <0bb29ec2-9dcb-653c-dda5-0825aea7d4b0@redhat.com> <537e970f062e0c7f89723f63fc1f3ec6e53614a5.camel@linux.intel.com> <06ca452e-90b3-c1b5-f2c0-e8da2444bcfe@redhat.com> <03e1e95c2cc8d6e3206212df48a971e9696d3b20.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <03e1e95c2cc8d6e3206212df48a971e9696d3b20.camel@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 17, 2019 at 08:31:59AM -0800, Alexander Duyck wrote: > > > > I think you recently switched to using an atomic variable for maintaining page > > > > reporting status as I was doing in v12. > > > > Which is good, as we will not have a disagreement on it now. > > > > > > There is still some differences between our approaches if I am not > > > mistaken. Specifically I have code in place so that any requests to report > > > while we are actively working on reporting will trigger another pass being > > > scheduled after we completed. I still believe you were lacking any logic > > > like that as I recall. > > > > > > > Yes, I was specifically referring to the atomic state variable. > > Though I am wondering if having an atomic variable to track page reporting state > > is better than having a page reporting specific unsigned long flag, which we can > > manipulate via __set_bit() and __clear_bit(). > > So the reason for using an atomic state variable is because I only really > have 3 possible states; idle, active, and requested. It allows for a > pretty simple state machine as any transition from idle indicates that we > need to schedule the worker, transition from requested to active when the > worker starts, and if at the end of a pass if we are still in the active > state it means we can transition back to idle, otherwise we reschedule the > worker. > > In order to do the same sort of thing using the bitops would require at > least 2 bits. In addition with the requirement that I cannot use the zone > lock for protection of the state I cannot use the non-atomic versions of > things such as __set_bit and __clear_bit so they would require additional > locking protections. > I completely agree with this. I had pointed out in an earlier review that expanding the scope of the zone lock was inappropriate, the non-atomic operations on separate flags potentially misses updates and in general, I prefer the atomic variable approach a lot more than the previous zone->flag based approach. -- Mel Gorman SUSE Labs