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.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 E1E23C32750 for ; Tue, 13 Aug 2019 15:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABAF320844 for ; Tue, 13 Aug 2019 15:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565708693; bh=jBWtDT4ufSn9QtVnPHnhvjm/TwSt54tI6bhoZdhVv58=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=q2ggM+rx17CD3xkXuoSqsMYbCf5kkM2kcdLi0ybD0aPGhWIaHuxFSIF6zlIhPeLBq 9cQ2k+c7k7ycwQAMhZJX5FnxZBASMV0nheE2ObXORIybRG/Y4C85g94sDs74ORjOP6 vBYpKjOzvgevcd8lBtvaGcbKJfdo1bqbnDH841II= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729821AbfHMPEx (ORCPT ); Tue, 13 Aug 2019 11:04:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:54418 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729474AbfHMPEw (ORCPT ); Tue, 13 Aug 2019 11:04: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 098ECACC1; Tue, 13 Aug 2019 15:04:51 +0000 (UTC) Date: Tue, 13 Aug 2019 17:04:50 +0200 From: Michal Hocko To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Minchan Kim , Alexey Dobriyan , Andrew Morton , Borislav Petkov , Brendan Gregg , Catalin Marinas , Christian Hansen , dancol@google.com, fmayer@google.com, "H. Peter Anvin" , Ingo Molnar , joelaf@google.com, 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 , 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 v5 2/6] mm/page_idle: Add support for handling swapped PG_Idle pages Message-ID: <20190813150450.GN17933@dhcp22.suse.cz> References: <20190807171559.182301-1-joel@joelfernandes.org> <20190807171559.182301-2-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190807171559.182301-2-joel@joelfernandes.org> 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 Wed 07-08-19 13:15:55, Joel Fernandes (Google) wrote: > Idle page tracking currently does not work well in the following > scenario: > 1. mark page-A idle which was present at that time. > 2. run workload > 3. page-A is not touched by workload > 4. *sudden* memory pressure happen so finally page A is finally swapped out > 5. now see the page A - it appears as if it was accessed (pte unmapped > so idle bit not set in output) - but it's incorrect. > > To fix this, we store the idle information into a new idle bit of the > swap PTE during swapping of anonymous pages. > > Also in the future, madvise extensions will allow a system process > manager (like Android's ActivityManager) to swap pages out of a process > that it knows will be cold. To an external process like a heap profiler > that is doing idle tracking on another process, this procedure will > interfere with the idle page tracking similar to the above steps. This could be solved by checking the !present/swapped out pages right? Whoever decided to put the page out to the swap just made it idle effectively. So the monitor can make some educated guess for tracking. If that is fundamentally not possible then please describe why. -- Michal Hocko SUSE Labs