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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 8B7DBC433E2 for ; Wed, 9 Sep 2020 04:20:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F1F3C21D40 for ; Wed, 9 Sep 2020 04:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="h36kM+lT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1F3C21D40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A49B6B005A; Wed, 9 Sep 2020 00:20:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2559E8E0001; Wed, 9 Sep 2020 00:20:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16C256B0071; Wed, 9 Sep 2020 00:20:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 0143A6B005A for ; Wed, 9 Sep 2020 00:20:06 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B17F53626 for ; Wed, 9 Sep 2020 04:20:06 +0000 (UTC) X-FDA: 77242220412.06.jewel59_040396a270da Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 8750910050D84 for ; Wed, 9 Sep 2020 04:20:06 +0000 (UTC) X-HE-Tag: jewel59_040396a270da X-Filterd-Recvd-Size: 4223 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Sep 2020 04:20:06 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id k15so995259pfc.12 for ; Tue, 08 Sep 2020 21:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3LP46ySnI2xDx74RsYVuIFFKElqOmtzPA4koaAcc6C4=; b=h36kM+lTNfnMAxtTC11+wijbU0dUb+RRyuImhwpazjMoH1jWjPQ/XbJxXgHZNPvtkd DAYepA2TpuaKw2py7MeoNBYmmwnedkTOkuDuDnfDJnP6SE2kREkEcJ5rg6hMK2rZo4xQ zVTzUmzEF2PtGGnWRu0iY+M2fwAfnZkG++zMhxnCCcGpBdoaHJOp88bDrexVNC7/RmH7 hj4IFkjATHqS/lb5UFxCVUzH9Od9LbxEYnsqQ/zvVA3uVCrppJH1pJIXB8ogGfWEBzdx zFFnHQ24kzoqh5ZWb15QoeGYfb26SfoN8dfiXdpDpx471/KBUMqibASQnCziNBmP4R3u Q5Aw== 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=3LP46ySnI2xDx74RsYVuIFFKElqOmtzPA4koaAcc6C4=; b=A+DZUy+/IBpPNTaEALJgbhcjftNciiFltKb9eQjL3nEcWCuF3TKYpNTK/lzx/xguMZ b0h+I0rMqBsy6tPXo5QaP2g0IbYSTaYgDmAfb48yQZ/zRH5H4I7R7SIhFkqByWSsukYE iGaLsdqk+NFeU03ADXLWl4KlsKIIJoHPxNcO+cv11rXIIsprtvjnVQ2HiBMoiX0rKigx XU4yQm+ajWfH0CvxEzxWLRAHCClPqlFFfWrpSb0CxDWxCeKjlKp+hCnLFMj7e8YC8dBh Gitmrnn1MOO8WH16VQ4CIlnXDULjCPtbp4AnsF+o3JECs1UdeZ1+vedS3hWVQll7Ft1v CtqA== X-Gm-Message-State: AOAM530YeRkY+MovU9j9kfKxs6NyWy+7qsd7Xj4rL+bAoeVFHyUe8yX2 QhvfFy2h8G+TWc9OlohSXLPuis/Jh3Ec3My+YxvX0w== X-Google-Smtp-Source: ABdhPJwnPsQQ3cOrC/3M4+xwMi+fo+XFlMR2+vKr4m+7nvqnLXLlLZlg9eSyE5S6Sh3SR6umL/g3O6AswKoMhElSljw= X-Received: by 2002:a63:9041:: with SMTP id a62mr1509992pge.273.1599625204761; Tue, 08 Sep 2020 21:20:04 -0700 (PDT) MIME-Version: 1.0 References: <20200908142456.89626-1-zangchunxin@bytedance.com> <20200908150945.GA1301981@chrisdown.name> In-Reply-To: <20200908150945.GA1301981@chrisdown.name> From: Muchun Song Date: Wed, 9 Sep 2020 12:19:28 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm/vmscan: fix infinite loop in drop_slab_node To: Chris Down , zangchunxin@bytedance.com Cc: Andrew Morton , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 8750910050D84 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Chris, On Tue, Sep 8, 2020 at 11:09 PM Chris Down wrote: > > drop_caches by its very nature can be extremely performance intensive -- if > someone wants to abort after trying too long, they can just send a > TASK_KILLABLE signal, no? If exiting the loop and returning to usermode doesn't > reliably work when doing that, then _that's_ something to improve, but this > looks premature to me until that's demonstrated not to work. Sending a TASK_KILLABLE signal? It didn't work now. Because the the current task has no chance to handle the signal. So I think we may need to do any of the following things to avoid this case happening. 1. Double the threshold currently hard coded as "10" with each iteration suggested by Vlastimil. It is also a good idea. 2. In the while loop, we can check whether the TASK_KILLABLE signal is set, if so, we should break the loop. like the following code snippe. Thanks. @@ -704,6 +704,9 @@ void drop_slab_node(int nid) do { struct mem_cgroup *memcg = NULL; + if (fatal_signal_pending(current)) + return; + freed = 0; memcg = mem_cgroup_iter(NULL, NULL, NULL); do { > > zangchunxin@bytedance.com writes: > >In one drop caches action, only traverse memcg once maybe is better. > >If user need more memory, they can do drop caches again. > > Can you please provide some measurements of the difference in reclamation in > practice? -- Yours, Muchun