Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp211435imw; Mon, 4 Jul 2022 07:54:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s3mwbFOJO+t0bs8E87ar+idV+LCjPBlRPsxITZb/Cv+PV7psbpMK4jRujORYumriWRtVIY X-Received: by 2002:a17:907:2d09:b0:722:f0bf:ac26 with SMTP id gs9-20020a1709072d0900b00722f0bfac26mr29469627ejc.77.1656946473985; Mon, 04 Jul 2022 07:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656946473; cv=none; d=google.com; s=arc-20160816; b=L2Gu5ckDMbQfUf5zRaH4RAelnXqsg7SJ8ZPhf1fisvD3Buvd/vkjAP5fSlnEtnXFKe 2sLD/FEFDL0v22B7SlrUMm8ByU6TAtgj7I70XLRwkuj9PY1wU+vtyl9vSBWk+mB2h4vZ 5u75HPsKiFUmKxEcEfAVm/qiUgCbg3SGIdAATzo3lZWiO4sPwDx2LZsXmPnr8MXmNvZ3 SerFVsbKHRX7kC2Ts7IRtl59ZY3Bn0+tGiIDckGqV+U47o3hfAEhmCnXfzMkcnMCCy58 8AvBQqhZVKZPm33TVWxmCZ3l0KBG0dzZzlVRs+xYibRInsfa22+lXVFS/3uWCUwfC2BD uLJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=CAxWQ9NhdZjwnh3NBb4lAHsXOxATS56cntUW47YLCw4=; b=ZPDIL5kuTwzSDOidiIJLWi+B54akyrkCrg8LoR3ZuRrR1C+JIjphPATJpqDvYDHY15 vh75GfjmZvo/+YwNOdpXOdCx2bak4fD0kmc3Y1IgShYxNq7BUcS4IItgo8I7eigrbxKp 0PGVBYgccAJsSa6FIJfuw63GPsCRtMPIsje/5rOouZ+KNS2sw4gcqvvzBptzoffLboeA DcEc4JSI+cK4I1xMJa3Qa2gNFqmK6NLqKaZ/GWvn84+QuoO9wvmxthYhn4Air9+dQfZg b87i9ZDveO7vainHCIrDXUC3yC0fygMFTnNq5u6pSJuI52awsrTj03KuExI1PJgbRwY6 dyFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XlNRsO3J; dkim=neutral (no key) header.i=@suse.cz header.b=x8DzM+Cr; 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 o2-20020a056402438200b0043a1dad2367si7354363edc.582.2022.07.04.07.54.08; Mon, 04 Jul 2022 07:54:33 -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=@suse.cz header.s=susede2_rsa header.b=XlNRsO3J; dkim=neutral (no key) header.i=@suse.cz header.b=x8DzM+Cr; 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 S234105AbiGDOk7 (ORCPT + 99 others); Mon, 4 Jul 2022 10:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234918AbiGDOko (ORCPT ); Mon, 4 Jul 2022 10:40:44 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3DC11478 for ; Mon, 4 Jul 2022 07:39:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2908E20272; Mon, 4 Jul 2022 14:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1656945598; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CAxWQ9NhdZjwnh3NBb4lAHsXOxATS56cntUW47YLCw4=; b=XlNRsO3JE0e31wuW7i0y+kyLIl3aF4F8Hw0mMlFekSq5j8mG5sh26unraX71Gu7gO+cyZd 3ETbCuXfMMSQrMbmPRjeoZJyCzm9NGynAnjPSJOVudI6kdvomGcNCZjOSkHMj82TtPrTEH 85gCTQrdyv63BXe4kBYa9YmUkK8+CYs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1656945598; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CAxWQ9NhdZjwnh3NBb4lAHsXOxATS56cntUW47YLCw4=; b=x8DzM+Crawj0He+ND5c4l9U5IZ+8hUWLjghX/JLrYwk08izvbBOyb1wxHTsIX7FB2MhPEy kkyO+zVdzCwUweCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 033C613451; Mon, 4 Jul 2022 14:39:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +2IDAL77wmJ0ZAAAMHmgww (envelope-from ); Mon, 04 Jul 2022 14:39:57 +0000 Message-ID: Date: Mon, 4 Jul 2022 16:39:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock Content-Language: en-US To: Mel Gorman , Andrew Morton Cc: Nicolas Saenz Julienne , Marcelo Tosatti , Michal Hocko , Hugh Dickins , Yu Zhao , Marek Szyprowski , LKML , Linux-MM References: <20220624125423.6126-1-mgorman@techsingularity.net> <20220624125423.6126-8-mgorman@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20220624125423.6126-8-mgorman@techsingularity.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 6/24/22 14:54, Mel Gorman wrote: > struct per_cpu_pages is no longer strictly local as PCP lists can be > drained remotely using a lock for protection. While the use of local_lock > works, it goes against the intent of local_lock which is for "pure > CPU local concurrency control mechanisms and not suited for inter-CPU > concurrency control" (Documentation/locking/locktypes.rst) > > local_lock protects against migration between when the percpu pointer is > accessed and the pcp->lock acquired. The lock acquisition is a preemption > point so in the worst case, a task could migrate to another NUMA node > and accidentally allocate remote memory. The main requirement is to pin > the task to a CPU that is suitable for PREEMPT_RT and !PREEMPT_RT. > > Replace local_lock with helpers that pin a task to a CPU, lookup the > per-cpu structure and acquire the embedded lock. It's similar to local_lock > without breaking the intent behind the API. It is not a complete API > as only the parts needed for PCP-alloc are implemented but in theory, > the generic helpers could be promoted to a general API if there was > demand for an embedded lock within a per-cpu struct with a guarantee > that the per-cpu structure locked matches the running CPU and cannot use > get_cpu_var due to RT concerns. PCP requires these semantics to avoid > accidentally allocating remote memory. > > Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka -fix looks OK too