Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1099675imk; Sun, 3 Jul 2022 17:21:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s1CRjsK3JmcvW4/g7COanRCi9KqKN3oM8uewJBM4gaVxBZtUGscAOJmPRtMr/Mt58IM0T+ X-Received: by 2002:a05:6a00:1d26:b0:528:3a25:ea3c with SMTP id a38-20020a056a001d2600b005283a25ea3cmr13986834pfx.67.1656894106527; Sun, 03 Jul 2022 17:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656894106; cv=none; d=google.com; s=arc-20160816; b=KK1EQUZ6fURHQXL0Q9pOeD1I5bXTaJHAo71xScYKJ++DCQXiodYFoR3rj1Sz1lUHC+ PpMAa4EsCZHw5IUsnmuGtew0yLAQWQ0smTUEgC3FybbDLHADJ452Koz9DDWsvIF301AV Va8bIr98xhwGGVmFXlpcb3PO2Bo7YQli+nOrtkU4YJIMOhOwczq9L3D8aObdzGSPW1W4 AmG4wgL0e2Tg4EZtOm4T+iHAgKeVJeYaladlWA9rav3YNwrMpQLNyRhvI/oxv4ZdB1TE 3s2qU59hMTDQVdePJ4j/ziC5CsXWEPGJ5CtImPcF+c7z6OMPnaJcrj6TrEOflUze49wH kjKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=KRmCyCl6hfKaskylHdwvMdCosKC56h7IkhXi/YqCgDw=; b=xYowc/i7/YUuq7wgJ6tj3QMV7LOAi0ApB/QEkGy3R8Cv6UDJUdU8/5hLd7nuy55FBl QK34eNWbeJdW0scdTMyJEjVhCqGLxlY0uedOCr+yrdptjyS6KPyX7OKZL9pxydIklszk 6zYk5hebrzAn6Pxuh4XYR0jlyQHANB85IK7IRsDLvGfMEfwQF1IPGc1lQkctSq1lQwMb QqtymjfIegg1xXH6zV4rermBLDsQhe3yUKU54OJGb+IQaD1MXfHJFNGia13OBkDDHFtZ Rpj40ui2u1Ua/pt2ETZ353TofRXHqD0Um+B1oOih4zmyaA4MzBU0c2KyDcu8q78BNXPv 7sjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=XgbQhYjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob18-20020a17090b391200b001e049d7ca99si16823189pjb.138.2022.07.03.17.21.26; Sun, 03 Jul 2022 17:21:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=XgbQhYjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbiGCX23 (ORCPT + 99 others); Sun, 3 Jul 2022 19:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232649AbiGCX2Z (ORCPT ); Sun, 3 Jul 2022 19:28:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B75F1105 for ; Sun, 3 Jul 2022 16:28:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8E36B80CE6 for ; Sun, 3 Jul 2022 23:28:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FD2BC341C6; Sun, 3 Jul 2022 23:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1656890902; bh=aEIGXJCrTumxaF3V0DderfrmrH0jO1WyIFbOI/yMixw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XgbQhYjIGDLZiG0Dhro2Rsr+hRmWMjyG8YOas3RxDMBM7GniGrmVreuyJFmRd6UPR YvvWlxPb/unCQ0yNA7Y2V4m9PIoy5oSXNuZx883GlFlFSAdk9hNJltdu/PdzG4LlPt TqbaP4VyTeSnu8GrvVaTc6PNA86FQEiBKm+rqZ2U= Date: Sun, 3 Jul 2022 16:28:21 -0700 From: Andrew Morton To: Mel Gorman Cc: Nicolas Saenz Julienne , Marcelo Tosatti , Vlastimil Babka , Michal Hocko , Hugh Dickins , Yu Zhao , Marek Szyprowski , LKML , Linux-MM Subject: Re: [PATCH v5 00/7] Drain remote per-cpu directly Message-Id: <20220703162821.f097d6e4b3e2a0114820a8d9@linux-foundation.org> In-Reply-To: <20220624125423.6126-1-mgorman@techsingularity.net> References: <20220624125423.6126-1-mgorman@techsingularity.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Jun 2022 13:54:16 +0100 Mel Gorman wrote: > Some setups, notably NOHZ_FULL CPUs, may be running realtime or > latency-sensitive applications that cannot tolerate interference due to > per-cpu drain work queued by __drain_all_pages(). Introduce a new > mechanism to remotely drain the per-cpu lists. It is made possible by > remotely locking 'struct per_cpu_pages' new per-cpu spinlocks. This has > two advantages, the time to drain is more predictable and other unrelated > tasks are not interrupted. > > This series has the same intent as Nicolas' series "mm/page_alloc: Remote > per-cpu lists drain support" -- avoid interference of a high priority task > due to a workqueue item draining per-cpu page lists. While many workloads > can tolerate a brief interruption, it may cause a real-time task running > on a NOHZ_FULL CPU to miss a deadline and at minimum, the draining is > non-deterministic. > > Currently an IRQ-safe local_lock protects the page allocator per-cpu > lists. The local_lock on its own prevents migration and the IRQ disabling > protects from corruption due to an interrupt arriving while a page > allocation is in progress. > > This series adjusts the locking. A spinlock is added to struct > per_cpu_pages to protect the list contents while local_lock_irq is > ultimately replaced by just the spinlock in the final patch. This allows > a remote CPU to safely. Follow-on work should allow the spin_lock_irqsave > to be converted to spin_lock to avoid IRQs being disabled/enabled in > most cases. The follow-on patch will be one kernel release later as it > is relatively high risk and it'll make bisections more clear if there > are any problems. I plan to move this and Mel's fix to [7/7] into mm-stable around July 8.