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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 A3480C433E0 for ; Tue, 19 May 2020 01:10:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C6CA20715 for ; Tue, 19 May 2020 01:10:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dGNrtd1l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C6CA20715 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C58F2900003; Mon, 18 May 2020 21:10:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE2DC900002; Mon, 18 May 2020 21:10:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA9EC900003; Mon, 18 May 2020 21:10:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 8E518900002 for ; Mon, 18 May 2020 21:10:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3FFCF181AEF10 for ; Tue, 19 May 2020 01:10:47 +0000 (UTC) X-FDA: 76831688934.29.print14_5e25879905c55 X-HE-Tag: print14_5e25879905c55 X-Filterd-Recvd-Size: 4454 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 May 2020 01:10:46 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id h26so9766879lfg.6 for ; Mon, 18 May 2020 18:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B2h6KEery4DV64pghw/Hx8NR4tW7hYF1jzYkIKgyqtY=; b=dGNrtd1l1ltG3c1HYSawMUrarOg9vPFevkjYgf5ZqEOz/RFCHgmLOPi0xuzrahF4CD obwX++9C4JOfIDaITvGasXg0MgbGrlbBO4SEtpt/Ud5eQZoGxcJJ0CeGE8NAHftQ3zg5 6PjTx8qXm3+Oyp8253JLyQxJoLUIW4EFUyuOK0P2z0KzLtFMhM5WWm9W1e8TeAXp/FoS dqu7Xx7sFMpzWnCWVGDDqB+hrBxXUb1BuHJB/YVrFyl61gB6v2wxiRoxsi0EuQv92FFu BSgc5f0uOl771PWB2t38NXIhaNwIekiNG7WOqDMNMxXdhXa9XE8XUcVPnMg2Gs1DbiEQ aPqg== 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=B2h6KEery4DV64pghw/Hx8NR4tW7hYF1jzYkIKgyqtY=; b=ZDQ+goc+thhiR901mKrJp8ZaodkRXCVNtWI5cZUP+CZCC1IW3Mflm9UcL+ChS/oxBx gQBmIYnGA+V63l8+sJKSr41UPQeE/vtPRiNEQeoymBf0muDcPDWBaqjt0dOWXe4GyVRR 51crYw+xIYzwTx8EI/Uniiu/YGFtFhFiAX5n3S+0WudGAYFUq2RGFydHjva8BfUh4rdS p3bAW5IhJqA12Bpj8mL6nWyA8hqZqZY4jYXwkpfNK4E7ycFURc3l0fQJZcaRKNZiCyW8 UH2JoThzR9DlPOPycXSLdmFNg4ID2nuRplVeqI5wfavv5WjYoEu52A3j4JNmFojLF7Uh iQtg== X-Gm-Message-State: AOAM531HCeOBmWnYPjS0RwYUnCjGkR+FJmYAF9TOoIJvs6Sppf0kORl9 oopmcSi9lJtLcWVZF4WMI+evNso1/FJQuWsrJUo5rA== X-Google-Smtp-Source: ABdhPJz8o98IPX34EDpeYcQ39qN3IWmJGDnhGJJX9GxFzTWgxc1FM1OUqpEv0+O5+KUo01rNe8hsvB8GNC0kZZ/gRG0= X-Received: by 2002:a19:d52:: with SMTP id 79mr12597235lfn.125.1589850645077; Mon, 18 May 2020 18:10:45 -0700 (PDT) MIME-Version: 1.0 References: <20200515202027.3217470-1-kuba@kernel.org> <20200515202027.3217470-4-kuba@kernel.org> <20200518174249.745e66d1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200518174249.745e66d1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Shakeel Butt Date: Mon, 18 May 2020 18:10:33 -0700 Message-ID: Subject: Re: [PATCH mm v3 3/3] mm: automatically penalize tasks with high swap use To: Jakub Kicinski Cc: Andrew Morton , Linux MM , Kernel Team , Tejun Heo , Johannes Weiner , Chris Down , Cgroups , Michal Hocko Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, May 18, 2020 at 5:42 PM Jakub Kicinski wrote: > > On Sun, 17 May 2020 06:44:52 -0700 Shakeel Butt wrote: > > > @@ -2583,12 +2606,23 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > > > * reclaim, the cost of mismatch is negligible. > > > */ > > > do { > > > - if (page_counter_read(&memcg->memory) > READ_ONCE(memcg->high)) { > > > - /* Don't bother a random interrupted task */ > > > - if (in_interrupt()) { > > > + bool mem_high, swap_high; > > > + > > > + mem_high = page_counter_read(&memcg->memory) > > > > + READ_ONCE(memcg->high); > > > + swap_high = page_counter_read(&memcg->swap) > > > > + READ_ONCE(memcg->swap_high); > > > + > > > + /* Don't bother a random interrupted task */ > > > + if (in_interrupt()) { > > > + if (mem_high) { > > > schedule_work(&memcg->high_work); > > > break; > > > } > > > + continue; > > > > break? > > On a closer look I think continue is correct. In irq we only care > about mem_high, because there's nothing we can do in a work context > to penalize swap. So the loop is shortened. > Yes, you are right.