Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp47160pxk; Tue, 8 Sep 2020 21:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBGZD6JCiX/WgmMeWL50VDO92319/0byOPP4oET1PiE46rzoxdRtcGL9NYouVTF4goR3Nn X-Received: by 2002:a17:906:29ca:: with SMTP id y10mr1682830eje.327.1599625420576; Tue, 08 Sep 2020 21:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599625420; cv=none; d=google.com; s=arc-20160816; b=cYOIj/eQSMnNzvIn5bcTfH62T6TdI7eVKqw9oXd4MxlCBE9ZxebAfBQ7ebX6zJDD2P TjRrQayoXszSGzrLm7fXekxvXw2JLMupgffh79K8d8HQrkhthDWs1BMHw7WWit9wmbsU iup7aZMoUTgi80ssXjlT4XTV9ghqKoz3gbXYsmv4HTgLWiXsHqEe86iUVrgxR/oJzRoD d5Cmr98bgxyxdkN7O+aMaOzzeiJnx7rm8QivJkOj3ERHo/gTsbQrQxpat1uicv/oLsYJ TZYeIHmWZnry1Vx0sYJrq2LmawBYrhVWGi5ylXB0ZtRQE+PWf+S3LGwmxKh0ATxEAw1D QVAA== 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=3LP46ySnI2xDx74RsYVuIFFKElqOmtzPA4koaAcc6C4=; b=eA6Ie+On4kT+ZxbNtC5Kqg4KI83oeqL0vRMle22XwJDIoCubLc7o6dgxT88AQQnrfq xUs5VqMks2aBl5nY1YuO/5MIJmxPYS81MAGEP7ZlrBQ59AMLwlGJV1YYRpzyuJB01v0q wbAl36aAcTSSROr3H3NQ3tv7f2eUM3N129gfjXhBhs3c4lfzkVpbAKodWwy7T1h3GNLm GXwlqCp7IkCm2Em3RuJY4+T6vk2kJUSILdfDaF/ijw3c4ILXrx+Or1GwZFPYzmI5jlcd 3KHxesvnL1ivedWwp+0D0mf7wnskUWXJZSuk2Ul9Ad7+2wUJvEE0J+EzzqXZV+MKCpeO 9PDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=h36kM+lT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si692367ejq.375.2020.09.08.21.23.03; Tue, 08 Sep 2020 21:23:40 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=h36kM+lT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725897AbgIIEUJ (ORCPT + 99 others); Wed, 9 Sep 2020 00:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgIIEUH (ORCPT ); Wed, 9 Sep 2020 00:20:07 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3775C061573 for ; Tue, 8 Sep 2020 21:20:06 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id o68so1144619pfg.2 for ; Tue, 08 Sep 2020 21:20:06 -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=A5jigt0F8UCy2MsB01Ix5nW8v+5HCC9WnZaroLBLLlHQ188xeSAKGneQ9d7m+E414n zcsd+iiWTOxd6N5KnzY8lSCkzswRU213WrhmTshAxbmpVu5RTE56ymqgzTR0N6mM5469 b94Rb5/kAID4bCOQVHckaNeHtf9hjQdWJCnLREq5XpzoZxnjuX7KdQQcVK5wPq6hZuQi EWUKQRfjQXhvRu0klAigwYM+muTTbr4xAK4kjSU25BMCcLfjw3Tzt3FHhHvAm/YJdmjR x0r28JKQFI+rjqmqkH2N+NYGP694Kj8XiRF/HdduxybLC0MtzcvIO7uBlUzmzvJvg0NF c/YA== X-Gm-Message-State: AOAM530cPcCYB/ZZODWMuqshY9DrVgc0i9gR/wbLaNE7rtrAgO00Ff8E 1zXz7CMHmRG0XaifJDr1Z+faNfe7wDaZOKLcpkEoXh7yM/RJobA0SKU= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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