Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4105822ybl; Mon, 27 Jan 2020 16:48:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzU5VV9GvogCu3ehW5p2aCnJ2N5VCzeuklbqB0egWNvk7RtiyRYJt2ztmeA1itxPjN7jw+9 X-Received: by 2002:a9d:65da:: with SMTP id z26mr14520358oth.197.1580172490637; Mon, 27 Jan 2020 16:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580172490; cv=none; d=google.com; s=arc-20160816; b=J2yIf7dkldcFmLWB4L77WlwuEg4kCFDG16ZD0oIGXUs0UdZaX2ppMH6IYyOUvTGjJp PofjEzN3KkOVCY1qoapW59VWVcOS8Dt63HXxBtNWoSb/WCZyt9UNY+gnJTRTx0R4uKS/ vyLt2OVpQPFIna1nuGe0tx4t8JQs9nQw+WZ332mXnCVlXxvo+sVOKkcInolRftNDhf48 r7hBe5O1F6qjLPBFI7qbPo17HCiu75wSpw2N0EtQZFARPxxD7EY/Y2AxR1oQy9ujJ0c2 m9MZBygo5ooNgpf6+FAkuEJ+9qCkroZjKBCgNWkmmLrrUzbOx3fqkJhCO0xdNsET+G4B kSGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=CAMZ8Aw/a/sq7vYMNuydKAQ+vHD5b05Zm+cMKCnvvbE=; b=Kz3KARjCFVm+Rm7o6IaVmVIPHrjqLpCBoOPOZxFpamWcfLUmYQ2wgaLm2SUA2EylAT lwW5KgDMRNeavp0AOwv5Yo5eAk1t01UwWWGHu9gK2y/D50iRTAw1+zkEZ2hM6Yu3uYML ktkoGAJs4YF1+5JfOpRtyIijQ7G3kn1Jw5GDsqDoi9wN6JFsS5bbwf4KssCGX6RS18hA jM8QHNKXPWR7ZC4p8qbwUZ3rh0bwVn5qUb6UyWdgvkbkJc4XZqwDgVcmiyWv9Mbn2MvJ XVVDiGzfLvlGSKk2B8G6eoDWyywoctzid6ogcw2gl5/1f7TVrEBO1Dks2WEBjPoePIKx mohA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X4ON06sk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si3501177otn.189.2020.01.27.16.47.52; Mon, 27 Jan 2020 16:48:10 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X4ON06sk; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbgA1Aq3 (ORCPT + 99 others); Mon, 27 Jan 2020 19:46:29 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:34337 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbgA1Aq2 (ORCPT ); Mon, 27 Jan 2020 19:46:28 -0500 Received: by mail-ot1-f67.google.com with SMTP id a15so10388869otf.1 for ; Mon, 27 Jan 2020 16:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CAMZ8Aw/a/sq7vYMNuydKAQ+vHD5b05Zm+cMKCnvvbE=; b=X4ON06sk4JCxWSzl6IyivPOV6QC6kyFa7EI/UrPdBL9l5GEVsV7qtSSKimkqt3CbtK WspgLPX8kJTVWlG6PCRAq632TiDYSewzIDQbh79DQU0hRMDb6ExTuIKNR45b9PI16NnX /g04KWqGgguKcPK8yEJ8h/t9kwND19nNLnUTrwza4YTdzPmf7/dTsT3B67JqSVR7xAPk 83D4pomEorKigx8pWW/nUo97P9A2t83O+WrAzxRYRqhDgyyE3qjPhM/7p52bYIDiHu+9 cQq4YA6ByW/C333B6qdpiE1ozu0nfBINO0G8I3a0/vZo8Gnig3BwvmXJv/JgT4LpxpSN h8ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CAMZ8Aw/a/sq7vYMNuydKAQ+vHD5b05Zm+cMKCnvvbE=; b=cPbgyCb7F/MUtRL8ViWS3kp/vdBe1BmGApT+v7rEbLTfDuYap9ZZWanRDHBwOwe9Cv EZZTTAvs3YLVtVGKfJ8P5sBxvbajaho7m77B4XMSi9qWOjTIkjgH3Bng7qvumn2X3xmD 1xHcFE/98DJu9VVNiSZohn8XbqlJ36z2zz9hce+wK+uQC/GnVa9WmJmrgLgXbhAU8r9i ye7yOjvCNrr2TB5xBwcS/LQQQzM9R8wwoiVSoIjOaR+ZyM1ZZTYDybjaOjkAJGvQHhI8 xJRo47oxKSHfDLz33D0URjQV+xbhM7l3NOdu6H4uJjdxM/v356nw+8gTc25F20I2U/kF YMTA== X-Gm-Message-State: APjAAAUSTnESjo+cTlW02iNc7O/xAwvH1HL8xdqwBDD82qEv5Y+MCSJ5 wpk2wET+hEUY9jDEQ3MpFbExlR7FrT1SMu+/pJR2LPH/eZw= X-Received: by 2002:a9d:62c7:: with SMTP id z7mr14168249otk.189.1580172387271; Mon, 27 Jan 2020 16:46:27 -0800 (PST) MIME-Version: 1.0 References: <20200109225646.22983-1-xiyou.wangcong@gmail.com> <20200110073822.GC29802@dhcp22.suse.cz> <20200121090048.GG29276@dhcp22.suse.cz> <20200127144931.GM1183@dhcp22.suse.cz> In-Reply-To: <20200127144931.GM1183@dhcp22.suse.cz> From: Cong Wang Date: Mon, 27 Jan 2020 16:46:16 -0800 Message-ID: Subject: Re: [PATCH] mm: avoid blocking lock_page() in kcompactd To: Michal Hocko Cc: LKML , Andrew Morton , linux-mm , Mel Gorman , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 27, 2020 at 6:49 AM Michal Hocko wrote: > > On Sun 26-01-20 11:53:55, Cong Wang wrote: > > On Tue, Jan 21, 2020 at 1:00 AM Michal Hocko wrote: > > > > > > On Mon 20-01-20 14:48:05, Cong Wang wrote: > > > > It got stuck somewhere along the call path of mem_cgroup_try_charge(), > > > > and the trace events of mm_vmscan_lru_shrink_inactive() indicates this > > > > too: > > > > > > So it seems that you are condending on the page lock. It is really > > > unexpected that the reclaim would take that long though. Please try to > > > enable more vmscan tracepoints to see where the time is spent. > > > > Sorry for the delay. I have been trying to collect more data in one shot. > > > > This is a a typical round of the loop after enabling all vmscan tracepoints: > > > > <...>-455450 [007] .... 4048595.842992: > > mm_vmscan_memcg_reclaim_begin: order=0 may_writepage=1 > > gfp_flags=GFP_NOFS|__GFP_HIGHMEM|__GFP_HARDWALL|__GFP_MOVABLE > > classzone_idx=4 > > <...>-455450 [007] .... 4048595.843012: > > mm_vmscan_memcg_reclaim_end: nr_reclaimed=0 > > This doesn't tell us much though. This reclaim round has taken close to > no time. See timestamps. > > > The whole trace output is huge (33M), I can provide it on request. > > Focus on reclaim rounds that take a long time and see where it gets you. I reviewed the tracing output with my eyes, they all took little time. But of course I can't review all of them given the size is huge. For me, it seems that the loop happens in its caller, something like: retry: mm_vmscan_memcg_reclaim_begin(); ... mm_vmscan_memcg_reclaim_end(); goto retry; So, I think we should focus on try_charge()? More interestingly, the margin of that memcg is 0: $ sudo cat /sys/fs/cgroup/memory/system.slice/osqueryd.service/memory.usage_in_bytes 262144000 $ sudo cat /sys/fs/cgroup/memory/system.slice/osqueryd.service/memory.limit_in_bytes 262144000 Thanks!