Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3937574ybh; Tue, 6 Aug 2019 03:52:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkOoN6fb1LxGOaRwrfvytaEiH8D2u3l4TAsY0AIWK5PgAfxU3Em0Awavm1oVCx9P4sVwR/ X-Received: by 2002:a65:5584:: with SMTP id j4mr2484823pgs.258.1565088761768; Tue, 06 Aug 2019 03:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565088761; cv=none; d=google.com; s=arc-20160816; b=V3jHvhva/zff66rMxmvFiuHxs9BVsf9Rhfj2VzloXoCKBcAJj1D86Ih6NpC80N0wRz lQwiQBWzDo7ulLKQEphJrwncMgl8Ekh+lCZH/Vhp10WF3QL/RV/Q2Z/yhaKg2gI7Gpum gRR35+jRRVW3hhxxQHI3or+oQd5f5YpW1HQKQV0+mEoFA9A23hv0dwcVcIwUtVoMMZV8 XZG70f+i4plCSy0FitZRfQeaVBkrn840eOBDVbLkP9Q3zGDpS71EX13NN/wmJvf/rpH+ Y75c4rcM3AhAZLnbESffwOk05OR5Rvclxyg5FL+nP/qPQk2K63QomRNymu+dN5snfN7d +5yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VBsSFNtcL+N4QoS6rmkdGDQ3ht9M6mQGWdM1yqSruMU=; b=O3RkTNS05QIE/FiW9LO44kiZlZ9Xwc1hpmM8Fo+g+SKPOWLr35zPjDll1pTFP7QF+4 vtgQlJfEkmxbVOFMOUWrW4GFxaIEg/MVzoJ5Slm6oKsSwz7wXKg5BosfIQM+p5KjSgmu Lu+2rqqugdEFhaMv/eLJRXeTChUy9hwM8UDgePiKNvRGVawYZHy6X2Q6kHSOVE7+08s1 wfQ4UXUghqTPz3D6FL/Xm5Gk2P+BNQhseqcEuGhyhEvSy1uB1UTTHXpU6XHotTidpxG/ MV99ybZvx9lkgggOCSegz/mTikxCYQTxOd5f1wY2+vifCjuVV4a9Ri8NkA3E9caKMnFY UHNg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y62si19974198pgy.348.2019.08.06.03.52.26; Tue, 06 Aug 2019 03:52:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732571AbfHFKvw (ORCPT + 99 others); Tue, 6 Aug 2019 06:51:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:43404 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728845AbfHFKvw (ORCPT ); Tue, 6 Aug 2019 06:51:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CF4EBAFCC; Tue, 6 Aug 2019 10:51:50 +0000 (UTC) Date: Tue, 6 Aug 2019 12:51:49 +0200 From: Michal Hocko To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan , Andrew Morton , Borislav Petkov , Brendan Gregg , Catalin Marinas , Christian Hansen , dancol@google.com, fmayer@google.com, "H. Peter Anvin" , Ingo Molnar , Jonathan Corbet , Kees Cook , kernel-team@android.com, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , minchan@kernel.org, namhyung@google.com, paulmck@linux.ibm.com, Robin Murphy , Roman Gushchin , Stephen Rothwell , surenb@google.com, Thomas Gleixner , tkjos@google.com, Vladimir Davydov , Vlastimil Babka , Will Deacon Subject: Re: [PATCH v4 4/5] page_idle: Drain all LRU pagevec before idle tracking Message-ID: <20190806105149.GT11812@dhcp22.suse.cz> References: <20190805170451.26009-1-joel@joelfernandes.org> <20190805170451.26009-4-joel@joelfernandes.org> <20190806084357.GK11812@dhcp22.suse.cz> <20190806104554.GB218260@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190806104554.GB218260@google.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 06-08-19 06:45:54, Joel Fernandes wrote: > On Tue, Aug 06, 2019 at 10:43:57AM +0200, Michal Hocko wrote: > > On Mon 05-08-19 13:04:50, Joel Fernandes (Google) wrote: > > > During idle tracking, we see that sometimes faulted anon pages are in > > > pagevec but are not drained to LRU. Idle tracking considers pages only > > > on LRU. Drain all CPU's LRU before starting idle tracking. > > > > Please expand on why does this matter enough to introduce a potentially > > expensinve draining which has to schedule a work on each CPU and wait > > for them to finish. > > Sure, I can expand. I am able to find multiple issues involving this. One > issue looks like idle tracking is completely broken. It shows up in my > testing as if a page that is marked as idle is always "accessed" -- because > it was never marked as idle (due to not draining of pagevec). > > The other issue shows up as a failure in my "swap test", with the following > sequence: > 1. Allocate some pages > 2. Write to them > 3. Mark them as idle <--- fails > 4. Introduce some memory pressure to induce swapping. > 5. Check the swap bit I introduced in this series. <--- fails to set idle > bit in swap PTE. > > Draining the pagevec in advance fixes both of these issues. This belongs to the changelog. > This operation even if expensive is only done once during the access of the > page_idle file. Did you have a better fix in mind? Can we set the idle bit also for non-lru pages as long as they are reachable via pte? -- Michal Hocko SUSE Labs