Received: by 10.213.65.68 with SMTP id h4csp685005imn; Fri, 6 Apr 2018 07:17:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jDakzbbMoVnMJroiLZvkHloCXpU2pVNMiR0cdgNvyWZGvODEBOk1nL6haLKQzr1Fv2xyk X-Received: by 2002:a17:902:a612:: with SMTP id u18-v6mr27510830plq.10.1523024221601; Fri, 06 Apr 2018 07:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523024221; cv=none; d=google.com; s=arc-20160816; b=HIer0CyiayV34Rb2ry7l/Wqc5sIyUsRlj5WF89RBXeidchSLI3iv1DJf5By/DkEnDh ROw5K/K48OEsRQhGPqm8fAckonKZBllpTR7H+ErGB0pT+SioCi0dV2REVFOANzxbo1k4 8Rriz8oCY/oNwesNWtuPEU7o59xtTJrOiRYnkKDONMyGkpgXZLjM/NboYs/mWtDURqRP VDSfFz0P8u6YKXrUVYZFc6sIdYfY6hVlA4xcAl3jPCFDlCYiACbbfa9UAw6SZ66V72Xm 6ZhOTIy1IFt+nx1j/QlmdYXd8tH3CFRQ97yAzP3fSs3ZV+xuQU6aSoLYhdx2eA2nYiaZ YLJw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=DZGX8UMMSb/gHPkaueqjmLtJwdiL8M7YEM0DWtQ4ksI=; b=Nt80SA32sOum3I3q2E9PuLqAB9OV+crsw2OwYbiuieCi4Oea6cUUuOhO4zdXhvRJXY TG8LUX9LPD/Pay/62mso7R7OxaCTCr/By58SoaLgnbwm+qk3vZWH3Rjl8zSOFHMnuQWD UawDjx4v+4/FfxzKtS8087898vsvIQ1taPoXrE5PxDlZ21oX/YnL33g+GxWHClznJCEe spTOTHm1LwwEXWVH3u+1gDz+Lkt1N+w4QZJCKMj0APhPh6z89beb38d/NHt/kJmx+xU+ CV+8I5Bpu9yh/1w2nGIHrrdvDAmdvSVA0HzcwI/xKZWzpXoM3x6ehvdMQCezuEJ6kaUP 0VbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qYtXsbDj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si6062354pff.205.2018.04.06.07.16.47; Fri, 06 Apr 2018 07:17:01 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=qYtXsbDj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756397AbeDFOPq (ORCPT + 99 others); Fri, 6 Apr 2018 10:15:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:50532 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753028AbeDFOPm (ORCPT ); Fri, 6 Apr 2018 10:15:42 -0400 Received: by mail-wm0-f65.google.com with SMTP id t67so3885158wmt.0 for ; Fri, 06 Apr 2018 07:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DZGX8UMMSb/gHPkaueqjmLtJwdiL8M7YEM0DWtQ4ksI=; b=qYtXsbDjKyZe1TYAPV5lBok/6VyRqXl/xqimQsyJ7h3cADZselA9hon5Zm49BuAgvm 72TjbfIlanUGZOm2M5y+l2o7H9p7BPKqfF6k8lQJX0ujYbAUhK4hTPDPIOYvWRYbiPNM Hu7xP/IkErmMvKL0b4o+ST6CdUcvOR465pSue6bf6uHiZfjTKh8qEAvkxzMU3Gdg2SKc L9OxcHuidR04qynO8l+C/8UQQRTZtb4LHwZFdhWTS9Z7nNfbw4ocGsEsB6fl8dFSCavq 6hgq1ujWx4VtQsjOexXdagK1zH6MU7janapAt4ebULaGMzrl7kYgVobRawG9GbCi7Jqp EcNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DZGX8UMMSb/gHPkaueqjmLtJwdiL8M7YEM0DWtQ4ksI=; b=KG7ztmoohYuRKax3ouY0P75fplq8dQWYjIuFsKReIvP4U0mYLyuhn/NhgugW5Yil5J PlLtFD2akH8SM37jOEAjwKDUgwdXhLbKeFpIcGGmOpacO/50hV0HoSYgYCPdqHVzFSW4 dqWBAYNyq1zUKfk4x2m3klks1yp1pUZMTTzVhB26ToBUyagbGlgmieu5M1vrfl10hZZ2 4ayDl5OZt5auLSHcfnBL7Bjm5njsBVCA/v9zjtdM57HxV/7jh5xHfr8o7ACiAQP4EPHS QPdmoKV2mYlyR39febw1j27RFjFZZYOc1G9FaMvRhs0hL1MS2Wp3IEVbVXNJrPCVCHuS kjWw== X-Gm-Message-State: AElRT7FEhU5jSyHSA4+N4rTiFgRF9t9N2e1PuaiQxni1LR6KHkIb7L65 YpOp8WGb/RD/y3C/3qmP+4QjgJnZqeaU79WlM1toUg== X-Received: by 10.28.91.65 with SMTP id p62mr15708410wmb.140.1523024141245; Fri, 06 Apr 2018 07:15:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.156.139 with HTTP; Fri, 6 Apr 2018 07:15:40 -0700 (PDT) In-Reply-To: <72db1bfb-aa79-3764-54fd-2c7ddbd07bea@virtuozzo.com> References: <20180323152029.11084-1-aryabinin@virtuozzo.com> <20180323152029.11084-5-aryabinin@virtuozzo.com> <72db1bfb-aa79-3764-54fd-2c7ddbd07bea@virtuozzo.com> From: Shakeel Butt Date: Fri, 6 Apr 2018 07:15:40 -0700 Message-ID: Subject: Re: [PATCH v2 4/4] mm/vmscan: Don't mess with pgdat->flags in memcg reclaim. To: Andrey Ryabinin Cc: Andrew Morton , Mel Gorman , Tejun Heo , Johannes Weiner , Michal Hocko , Steven Rostedt , Linux MM , LKML , Cgroups 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 Fri, Apr 6, 2018 at 4:44 AM, Andrey Ryabinin wrote: > On 04/06/2018 05:13 AM, Shakeel Butt wrote: >> On Fri, Mar 23, 2018 at 8:20 AM, Andrey Ryabinin >> wrote: >>> memcg reclaim may alter pgdat->flags based on the state of LRU lists >>> in cgroup and its children. PGDAT_WRITEBACK may force kswapd to sleep >>> congested_wait(), PGDAT_DIRTY may force kswapd to writeback filesystem >>> pages. But the worst here is PGDAT_CONGESTED, since it may force all >>> direct reclaims to stall in wait_iff_congested(). Note that only kswapd >>> have powers to clear any of these bits. This might just never happen if >>> cgroup limits configured that way. So all direct reclaims will stall >>> as long as we have some congested bdi in the system. >>> >>> Leave all pgdat->flags manipulations to kswapd. kswapd scans the whole >>> pgdat, only kswapd can clear pgdat->flags once node is balance, thus >>> it's reasonable to leave all decisions about node state to kswapd. >> >> What about global reclaimers? Is the assumption that when global >> reclaimers hit such condition, kswapd will be running and correctly >> set PGDAT_CONGESTED? >> > > The reason I moved this under if(current_is_kswapd()) is because only kswapd > can clear these flags. I'm less worried about the case when PGDAT_CONGESTED falsely > not set, and more worried about the case when it falsely set. If direct reclaimer sets > PGDAT_CONGESTED, do we have guarantee that, after congestion problem is sorted, kswapd > ill be woken up and clear the flag? It seems like there is no such guarantee. > E.g. direct reclaimers may eventually balance pgdat and kswapd simply won't wake up > (see wakeup_kswapd()). > > Thanks for the explanation, I think it should be in the commit message.