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 4435ACCA479 for ; Mon, 4 Jul 2022 16:33:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB68F6B0075; Mon, 4 Jul 2022 12:33:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3EF76B007E; Mon, 4 Jul 2022 12:33:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C05E06B0081; Mon, 4 Jul 2022 12:33:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B33596B0075 for ; Mon, 4 Jul 2022 12:33:58 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 95B71608B0 for ; Mon, 4 Jul 2022 16:33:58 +0000 (UTC) X-FDA: 79649964156.02.CEC8719 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 0376040002 for ; Mon, 4 Jul 2022 16:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656952437; h=from:from:reply-to:subject:subject: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=nPN7O4yutTfR76QUYkCeWKTkYNzlpYj/Kwqr9wYgmXI=; b=HeUrghCyRIi5mih2IIWe9fue3x/k5+qpM6pEoTXiwREp58+31k5R0pNP95kykRPSuE+UE9 UIOTDpna9qi9WZW+V/b6Gof3k+FIF9/OwDZaqvcCqFdHTqD/fseiXmJG9UumWg5ly/QgK+ wm7JDOei7kAeqdj0v21uwDueJ3n8MMU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-XuDIdYkyMmG-_uRHViKJiQ-1; Mon, 04 Jul 2022 12:33:56 -0400 X-MC-Unique: XuDIdYkyMmG-_uRHViKJiQ-1 Received: by mail-wr1-f71.google.com with SMTP id n7-20020adfc607000000b0021a37d8f93aso1500764wrg.21 for ; Mon, 04 Jul 2022 09:33:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=nPN7O4yutTfR76QUYkCeWKTkYNzlpYj/Kwqr9wYgmXI=; b=vY1mptzhRtE/JCu+YghXqG3Mck7DnqcfBkw3EjEfaFFumZbIABoaAKQ74cuuUTJsvt 27/fXalUuO2q8No5k81Cahvg7CSEp0yaLPqvRIl1bYSmX79E0dgSQadmeOE7JiR3H+bK i8OcV6aDMMe25XgfljwYyMJmxGJ/UWm0xT5QO9cr5MLeVdyPEdWdpJSfbtDKOgYHg1Vi Kso+ZXjRz8bL6o5W/T2kD1JjNmjGmGtarO6Epwk7QfE8Wnl591fOODY8SOyz/uj3Iv0W +E6kMhqAzXQBbJqFA3Sc0RUf6ZqZ3oTTVcUlJwvMQ6+39Y4k4NbP6PRhRUJ6AklGddil UpXg== X-Gm-Message-State: AJIora+Iv6TDSQPJOlBSI3z5+acdlgTSgRd6odGQT3pnBE5fPgGLHMkz +aoG/hNSQhip1ig+1KBy8zmBkW8KXqG2K51dN3P2Jp0TaO8+1J4D6jcVurZJf0QR0RbUVrq5my2 7YXgMV8JPPdM= X-Received: by 2002:a5d:534e:0:b0:21b:adf3:dc19 with SMTP id t14-20020a5d534e000000b0021badf3dc19mr26822715wrv.543.1656952435242; Mon, 04 Jul 2022 09:33:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLhSWU8M2vNb4jyFr+doYws0qpQ2mbL5enVcLAf041KKQbSEGOxeoSAr/MZoztVPnyelvcfw== X-Received: by 2002:a5d:534e:0:b0:21b:adf3:dc19 with SMTP id t14-20020a5d534e000000b0021badf3dc19mr26822690wrv.543.1656952434992; Mon, 04 Jul 2022 09:33:54 -0700 (PDT) Received: from ?IPv6:2a0c:5a80:1b12:b300:47b0:25ba:1a2e:72ac? ([2a0c:5a80:1b12:b300:47b0:25ba:1a2e:72ac]) by smtp.gmail.com with ESMTPSA id x1-20020a1c7c01000000b003a02b135747sm19910694wmc.46.2022.07.04.09.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 09:33:54 -0700 (PDT) Message-ID: <9de48555e9139c91289a48e9296c0af1a62811f3.camel@redhat.com> Subject: Re: [PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock From: Nicolas Saenz Julienne To: Mel Gorman , Andrew Morton Cc: Marcelo Tosatti , Vlastimil Babka , Michal Hocko , Hugh Dickins , Yu Zhao , Marek Szyprowski , LKML , Linux-MM Date: Mon, 04 Jul 2022 18:33:53 +0200 In-Reply-To: <20220624125423.6126-8-mgorman@techsingularity.net> References: <20220624125423.6126-1-mgorman@techsingularity.net> <20220624125423.6126-8-mgorman@techsingularity.net> User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656952438; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=nPN7O4yutTfR76QUYkCeWKTkYNzlpYj/Kwqr9wYgmXI=; b=Wk7Qfbn1WzwCbS5OWJXyHrCydQEz+AZkcp149tG42gWtNpcuRKzABM3u0GuGGcH/wcS40E Sp9fZqhu6tXhA/UfStt6GNXjQ5EvSFBijz08YpMYClTHdVfLIwj+cxSd+nrZolxPs702BU QhD/cwgB9b6lzdSr2Ztu6JCjaEwxYJo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HeUrghCy; spf=none (imf04.hostedemail.com: domain of nsaenzju@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=nsaenzju@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656952438; a=rsa-sha256; cv=none; b=VAO3I/iw55nv8EuRJAmxlD5MilagR4bEscMyMaYMtr30u5OFQzGiZ7MTlNgYbLTSQobf6T 5hlOXzFLzA8IgAO70BXa5uqjx1rxsJ/RPeAMHQoq9B+A7lr4vM+tGnpq/Vu4rRSpNXeEqb opwohFrK4TATk2XU/VYFAAit4IiI8h0= X-Stat-Signature: xenidbxywubng8h6ct6f6oomi16yyn11 X-Rspamd-Queue-Id: 0376040002 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HeUrghCy; spf=none (imf04.hostedemail.com: domain of nsaenzju@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=nsaenzju@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1656952437-930744 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: On Fri, 2022-06-24 at 13:54 +0100, 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) >=20 > 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. >=20 > 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_lo= ck > 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. >=20 > Signed-off-by: Mel Gorman > --- Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne Thanks! --=20 Nicol=C3=A1s S=C3=A1enz