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 961CDC433EF for ; Mon, 7 Mar 2022 17:24:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1ED798D0002; Mon, 7 Mar 2022 12:24:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 19CC28D0001; Mon, 7 Mar 2022 12:24:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 065B28D0002; Mon, 7 Mar 2022 12:24:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id E87518D0001 for ; Mon, 7 Mar 2022 12:24:51 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 70E7D81DF1 for ; Mon, 7 Mar 2022 17:24:51 +0000 (UTC) X-FDA: 79218265182.02.1A3FC9A Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf25.hostedemail.com (Postfix) with ESMTP id B0ABBA0011 for ; Mon, 7 Mar 2022 17:24:50 +0000 (UTC) Received: by mail-yb1-f170.google.com with SMTP id x200so32383896ybe.6 for ; Mon, 07 Mar 2022 09:24:50 -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=O5GVG/sTWbWul8w0pAEg6CAjRK4Deaq5sSA19pooufpUfip+1gqNbMxBZDgWfngg2N RbGXUnN8+XJAyGnvjfUH1DQwHJDbxElLtNNk/nZDp7N2CHqux2oni73NPLZCXNWuj50W 8t3NwCtD84fFE55dEa5WOaOue3IqfwIIWnaQbCMqwdu+mVo9pZhNQjVeDgDSq0cc+4DG GgO/RCrC1204WOYEUlOkiEfNztUzi8TaCeP//cDSlIDPjW5Voikalj8xgtnvqOeFr2N4 f5ZfruSrgn51CICp8ty7qKeWKtsepwWdP6fUsuj8kK59ci2NTrEECKIlIgRuX18+VU5C ZwKw== X-Gm-Message-State: AOAM530sTd3m+NJuURx+niiS3jpON7/tpEP69/tZRs3Nz+daIKzIE7Xp eGdp2UJoRRV9Vg+lqsp0HjIqmZHGRvmd4WQm7GPVSw== 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" X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B0ABBA0011 X-Stat-Signature: 3gthrisokr3ttqyfw6b39y3gcyworsr8 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BPGMtJYO; spf=pass (imf25.hostedemail.com: domain of surenb@google.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-HE-Tag: 1646673890-595255 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000019, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. >