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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A25FC77B78 for ; Tue, 2 May 2023 21:21:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E957B6B0078; Tue, 2 May 2023 17:21:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E46216B007B; Tue, 2 May 2023 17:21:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D36036B007D; Tue, 2 May 2023 17:21:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by kanga.kvack.org (Postfix) with ESMTP id 9B15B6B0078 for ; Tue, 2 May 2023 17:21:08 -0400 (EDT) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5083bd8e226so6772405a12.3 for ; Tue, 02 May 2023 14:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683062467; x=1685654467; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RzcMzqLnc5vNL8n9f33rayTWsgoEsdQ3LWpXeai0x68=; b=AizCll5EcTySHDHeFhODafbTbaPkzZnzdPYJe0NHMCb48SUOeoo7paZ2O47/+gqvyn o8We0rS48JxwG91DVx3fUovNfNVIUVaNzwq8RLO0T6zuS1JUIM/X87UbFPjfwoIFL1Sg NQ/L1e0DD44Fvof6ojhJ7DoVst7Fgd/DIczNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683062467; x=1685654467; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RzcMzqLnc5vNL8n9f33rayTWsgoEsdQ3LWpXeai0x68=; b=O0zaeZhTo9ZhM09tqDGqco9O9sl+fg041JVvYyCmmsGWCqwXGq5vpfm7o0sYJnjQSX wyM+P5NlOpVVYQnFkkYF3quuds565fpUn6ll8fprhJXoZKhheyzq/Avg7m+b9EMWVkvv Jav6TfUwPq1zRLGdLw6HZrla8veHuHfF+0mayKjJzGZ0uLUcLPDe3FZwh2AXDcKm6Qss MX3MZd1ZKSdu0SX8jzy+dLCDeFDxowfhtxc0U/3xUqBmxSEmYIbRUlJG31qT2KpSAw8a hfaT0yw3AobF+X/vIGo6qANVq1WcJeZzuF4HzEOhW8OXKwa08sw0JOeH8W3l1syM+Ck8 GEeg== X-Gm-Message-State: AC+VfDw5EtKruZQbH4eH2gZkhuzYg0If+cB+WzZKQt9cHXDar3BjzV+7 3XBxk0bOiHSPE5KhDm+0xGraQyWW8zT6PZmPdE2Vgw== X-Google-Smtp-Source: ACHHUZ7gRfZxaw5oI5tBvCSRLPCXdqm7pcIJIZktiAEBkGjJ34CXtmpe0jzq6mzLG7dHR29hauxNtQ== X-Received: by 2002:aa7:c849:0:b0:502:2494:b8fc with SMTP id g9-20020aa7c849000000b005022494b8fcmr9113014edt.7.1683062467499; Tue, 02 May 2023 14:21:07 -0700 (PDT) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com. [209.85.128.45]) by smtp.gmail.com with ESMTPSA id t1-20020aa7d4c1000000b005066cadcc54sm13700463edr.43.2023.05.02.14.21.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 May 2023 14:21:07 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-3f256b84f14so59875e9.0 for ; Tue, 02 May 2023 14:21:06 -0700 (PDT) X-Received: by 2002:a05:600c:1e20:b0:3f1:70d1:21a6 with SMTP id ay32-20020a05600c1e2000b003f170d121a6mr66599wmb.0.1683062466606; Tue, 02 May 2023 14:21:06 -0700 (PDT) MIME-Version: 1.0 References: <20230428135414.v3.1.Ia86ccac02a303154a0b8bc60567e7a95d34c96d3@changeid> <20230430085300.3173-1-hdanton@sina.com> In-Reply-To: <20230430085300.3173-1-hdanton@sina.com> From: Doug Anderson Date: Tue, 2 May 2023 14:20:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] migrate_pages: Avoid blocking for IO in MIGRATE_SYNC_LIGHT To: Hillf Danton Cc: Andrew Morton , Mel Gorman , Alexander Viro , Christian Brauner , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Yu Zhao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: Hi, On Sun, Apr 30, 2023 at 1:53=E2=80=AFAM Hillf Danton wro= te: > > On 28 Apr 2023 13:54:38 -0700 Douglas Anderson > > The MIGRATE_SYNC_LIGHT mode is intended to block for things that will > > finish quickly but not for things that will take a long time. Exactly > > how long is too long is not well defined, but waits of tens of > > milliseconds is likely non-ideal. > > > > When putting a Chromebook under memory pressure (opening over 90 tabs > > on a 4GB machine) it was fairly easy to see delays waiting for some > > locks in the kcompactd code path of > 100 ms. While the laptop wasn't > > amazingly usable in this state, it was still limping along and this > > state isn't something artificial. Sometimes we simply end up with a > > lot of memory pressure. > > Given longer than 100ms stall, this can not be a correct fix if the > hardware fails to do more than ten IOs a second. > > OTOH given some pages reclaimed for compaction to make forward progress > before kswapd wakes kcompactd up, this can not be a fix without spotting > the cause of the stall. Right that the system is in pretty bad shape when this happens and it's not very effective at doing IO or much of anything because it's under bad memory pressure. I guess my first thought is that, when this happens then a process holding the lock gets preempted and doesn't get scheduled back in for a while. That _should_ be possible, right? In the case where I'm reproducing this then all the CPUs would be super busy madly trying to compress / decompress zram, so it doesn't surprise me that a process could get context switched out for a while. -Doug