Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2214673ybt; Mon, 15 Jun 2020 23:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjo9yLFtAi8uwQgTCa4GhZu8/to5u9MqxXiLBGhlQa7P+QQuBUkrtRj/mGo6rkvDJKMyeT X-Received: by 2002:a17:906:6888:: with SMTP id n8mr1254404ejr.159.1592288401848; Mon, 15 Jun 2020 23:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592288401; cv=none; d=google.com; s=arc-20160816; b=JLsHDnXmGJA/2YesWVJssqZW6q+eCByzvzRDZRF+huzdxUEMXq7NyS77wfB2LuOmKV +1IIPpo9klMdKCaSPiGmqEz1zF3QO6NsiVisnDFBMha/E+okMZGULpDFF5Xt4EQxi/xd O0g5kbkkk/+DQcEczHpIZpMbfNyPpOVHX84r92QA7PI+kP48X70f3I2/OW3gfXLXd3WE VpJtxcgcyVpiMGY2/PZSN6oj1R7pxRqXCsgzx5BL/DEjjMZITZIcXTKfL1HoDJPB1H1J fcaUKN3TvY5p6d1TdtaRRESgEy2SLoXgFrRu7xSkA10tcHjP8j6oQ6CVtB61R5nGgCwz i6ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=D0g2Zexmxg2oUoAy0qKEpYCw2yFMuRTQ0zuH6SkQeSY=; b=xD357wVqPKD5D1XHz7x8ZclkEfpZVMtXbJ79LMjsI8QkZpEMU/HYNPbP0OQYM4k9Hu M4ggzWM76Iq6bnB96bdxd3uzpkYHq1RNaH3uzgWIC+SI0m0/MyegrWVDYLIcau+RA0bZ 0XJRFqyHHvwUUB7k1sJn+KO2WRv+9fU4NpQGGxKmCn4Aiay24txWwQBK01U6IsQhC0Cm N4b2m510uQxfwvroohAUmyYzSX4/xIvmiRcepD4SDXrtc9HfLZIucun7Mb+IaZvktGWN 2rqn0NvkNhwpxXT5/tcNegStFBTnN7bo6ncmjTqTxZRNilZTcXMPdDi7mxVQbCk76hv7 XA5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="EZvwL/pq"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si10741375ejz.197.2020.06.15.23.19.39; Mon, 15 Jun 2020 23:20:01 -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=@gmail.com header.s=20161025 header.b="EZvwL/pq"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgFPGRO (ORCPT + 99 others); Tue, 16 Jun 2020 02:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgFPGRM (ORCPT ); Tue, 16 Jun 2020 02:17:12 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D7AC05BD43 for ; Mon, 15 Jun 2020 23:17:12 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id g12so7914215pll.10 for ; Mon, 15 Jun 2020 23:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D0g2Zexmxg2oUoAy0qKEpYCw2yFMuRTQ0zuH6SkQeSY=; b=EZvwL/pqQUFmftZMJwsT6Nh+iHePfWMkBZZ3jamWdPjuCY0/AtBONRXTvF51Y3lFQj TOJyeflmZone8HN/oO1ZPspofS0tayc0TANM+7CDfRPFV53RS0d1hW1dZM85WOr30ONN BWgd5jK5TJ2zykOEsOw0Qq0WvSZJH0HuDJQzYpvTeXwJWLtL22Z8qNp61ZDhT7Q5CCSM IDZC+2WvcPTeOtgqClMkfl76HW1LCJ2qPGTiTDRtZ58QhmnhkK2fsVL0CTvI61v/M5kN 0YZLelvQk3PDUNxztZ0OHQwNnTb80Ndyy75oKBLTj0X2fZrmTEnlceVWl5AjQUUyOPIw CtUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D0g2Zexmxg2oUoAy0qKEpYCw2yFMuRTQ0zuH6SkQeSY=; b=UpPDzDDGB5I5n5TFs+8NIyqU93NaVjQWhNNrVPvxxfIhEkjAJ6EoodFfdvaKYm+R/Z Pcdg0WeGjTKt3g6wZjW44+PrShqB4G3KcUCb2qa9yp1PVSGQA3VWL+nA/LxOAvmG3dMs lhREbyi8U7d233egXlYiaUm+XRPCyn7accZZErBNAQSdsO5clueJ5HokpAw185QA/YjI ESIlABzUqrXRP0tIY+xySmGB5BetBTEK5COiMCqe9vHouN9GC3QXrOrLZRTFtnMgqnw/ PAWdwwV8j3K9PMkREn2GQvB1v5iiKI6Jpcg/obsofUcfhTD0RnYDqbd75dfr04ywlsMR RtZQ== X-Gm-Message-State: AOAM530wWGNSrQMDc6vSEWYxKNAbJCaSEVobZVAk1ismA7ddAhNfn7vq mI1EzN86l7kA6E/ksRVovMg= X-Received: by 2002:a17:90a:9f81:: with SMTP id o1mr1291945pjp.139.1592288231638; Mon, 15 Jun 2020 23:17:11 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id 207sm15449267pfw.190.2020.06.15.23.17.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2020 23:17:11 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Rik van Riel , Minchan Kim , Michal Hocko , kernel-team@lge.com, Joonsoo Kim Subject: [PATCH for v5.8 3/3] mm/memory: fix IO cost for anonymous page Date: Tue, 16 Jun 2020 15:16:44 +0900 Message-Id: <1592288204-27734-4-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592288204-27734-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1592288204-27734-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joonsoo Kim With synchronous IO swap device, swap-in is directly handled in fault code. Since IO cost notation isn't added there, with synchronous IO swap device, LRU balancing could be wrongly biased. Fix it to count it in fault code. Signed-off-by: Joonsoo Kim --- mm/memory.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index bc6a471..3359057 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3143,6 +3143,14 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) if (err) goto out_page; + /* + * XXX: Move to lru_cache_add() when it + * supports new vs putback + */ + spin_lock_irq(&page_pgdat(page)->lru_lock); + lru_note_cost_page(page); + spin_unlock_irq(&page_pgdat(page)->lru_lock); + lru_cache_add(page); swap_readpage(page, true); } -- 2.7.4