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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E64C433F5 for ; Mon, 7 Mar 2022 17:24:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244425AbiCGRZr (ORCPT ); Mon, 7 Mar 2022 12:25:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233824AbiCGRZo (ORCPT ); Mon, 7 Mar 2022 12:25:44 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957543FDAD for ; Mon, 7 Mar 2022 09:24:49 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id z30so19579985ybi.2 for ; Mon, 07 Mar 2022 09:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EGPJ/HBGsghMSfv75dZ55E/modOMRbB4DgUrUtGerYI=; b=BPGMtJYOuDSup6ABrw63zKcQcdaRgQA28roFUUiDE807kSYNqXhfS2fkGGTzyBFsTe F7BEDShNKTtwy5KDDWo6TLRvUqgxfEOtx4cZDhJkFz7oTxuMTLc5Kba6O8bDjgs/YsoB 7h2w1k2h+AiczCsVtTzQCizj2ANjF8U3HRfZskUj76Zanf1ydCjILKRbKreFyLrj/wUD GhXrPD/s5TFIXs51Z4QgAzQBNZ1F4WVnSwnYfTQkdV4e3tNdIftuS1awIlqbGWIu1u2d jUxb+5k0gPlSrAi91wdKchwdLqqs8GJdBEDPH96yWEVSre6gSYOR+2UzAi9BIrErYjQ1 FNmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EGPJ/HBGsghMSfv75dZ55E/modOMRbB4DgUrUtGerYI=; b=C9tc3V0eDA51Rf4aD561Umy64KLHcCnRRZAixXbxa0MfIpDsLV4TSsjISsm97DVhCs 4QHpD4Pi63vgWU/84IGAJnXvG/LOiUzKNTbgEIjXm5aZ/hegU6KwUc/q0/18NKnWRC5M FnpkFE6QgFLVKccB8Znig9cgaxYhBFh6+B7OepJCpEZze0F5ifiCOJeocNIMchq9vgjT 4WesVWXaS4HWIf0f6G97gj8TXk2BfJ4wzBxtc/ntDDcqivcfkmJrYL/VaoHqxhaX3xB3 +U5cTSgAGIXKzi1m6GWyGP7Z5nv50WURSSumSN5he2ehDoZwIZ+f9pHhJiCRzPSzIdLe 3KUQ== X-Gm-Message-State: AOAM533GrXRJFaQlvP/jwQkJMXXKulcesXNjRbby13w3iWBVs7I73HpG OqmxucUMKeiQXd9yuyPGs09vA78gqw/jT7Zzy7cCDA== X-Google-Smtp-Source: ABdhPJyfn/Hihw6wCA/9To+ztHYEtcwYnDPnZ6vIdFqOoNI/1L+jjcZSq765aEYJ1Zq8fTaKXLdyJxjMvZ5NhfFZi44= X-Received: by 2002:a25:2bc5:0:b0:628:71cf:99c with SMTP id r188-20020a252bc5000000b0062871cf099cmr8836283ybr.553.1646673888520; Mon, 07 Mar 2022 09:24:48 -0800 (PST) MIME-Version: 1.0 References: <20220225012819.1807147-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 7 Mar 2022 09:24:37 -0800 Message-ID: Subject: Re: [RFC 1/1] mm: page_alloc: replace mm_percpu_wq with kthreads in drain_all_pages To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Petr Mladek , Peter Zijlstra , Roman Gushchin , Shakeel Butt , Minchan Kim , Tim Murray , linux-mm , LKML , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 7, 2022 at 9:04 AM 'Michal Hocko' via kernel-team wrote: > > On Thu 24-02-22 17:28:19, Suren Baghdasaryan wrote: > > Sending as an RFC to confirm if this is the right direction and to > > clarify if other tasks currently executed on mm_percpu_wq should be > > also moved to kthreads. The patch seems stable in testing but I want > > to collect more performance data before submitting a non-RFC version. > > > > > > Currently drain_all_pages uses mm_percpu_wq to drain pages from pcp > > list during direct reclaim. The tasks on a workqueue can be delayed > > by other tasks in the workqueues using the same per-cpu worker pool. > > This results in sizable delays in drain_all_pages when cpus are highly > > contended. > > This is not about cpus being highly contended. It is about too much work > on the WQ context. Ack. > > > Memory management operations designed to relieve memory pressure should > > not be allowed to block by other tasks, especially if the task in direct > > reclaim has higher priority than the blocking tasks. > > Agreed here. > > > Replace the usage of mm_percpu_wq with per-cpu low priority FIFO > > kthreads to execute draining tasks. > > This looks like a natural thing to do when WQ context is not suitable > but I am not sure the additional resources is really justified. Large > machines with a lot of cpus would create a lot of kernel threads. Can we > do better than that? > > Would it be possible to have fewer workers (e.g. 1 or one per numa node) > and it would perform the work on a dedicated cpu by changing its > affinity? Or would that introduce an unacceptable overhead? Not sure but I can try implementing per-node kthreads and measure the performance of the reclaim path, comparing with the current and with per-cpu approach. > > Or would it be possible to update the existing WQ code to use rescuer > well before the WQ is completely clogged? > -- > Michal Hocko > SUSE Labs > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >