Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1471010rdb; Sun, 7 Jan 2024 23:10:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpEcmvOk1LEAyXBsWHy/pwxoRTxu7HUVHCi3cFV2R1GrQUKVSU1+/8Hxoel1bGCdDLYbAf X-Received: by 2002:a17:90a:6281:b0:28b:e160:68aa with SMTP id d1-20020a17090a628100b0028be16068aamr1402432pjj.44.1704697823759; Sun, 07 Jan 2024 23:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704697823; cv=none; d=google.com; s=arc-20160816; b=dtprWzMG+TFwq/JWsI2Vxk2CTR2+bFTJ6eZ2U1h1y0fJ3mX+K7bCN4M3/BC8Opr+wM aTz/r4OoEKqVdqay/NZllE2M3PY5NkOtPUL9OdYMrpBzP6wsaZbxDOt62FTUBy7GpgEj Vdt3D+PaNu0RwVOacwUklYIDloy9ktq61YSWsaggMpu2J92F1koHGcifrSGZMspvcjvI y3TbdtVbTQpH2eVm1aXeGr748sgXwmz7Q2hTlfopEhX28SCAstLJr7S0V/89uaWj+N7l J/teMWkMdV2xXCDWTiHxaeAPEnTlOAgEAjAt+h0XmnwJ1VCXAU4sA034mdPU5FGwrmRa Pxfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=3RW63WU74IgH4C3yx53948n+DczEto+0BH7TDeGCP+U=; fh=NY8fPgzANZrJf7tRbJ1muzm4JRH2FKG7DCqf5wGb9vc=; b=U301vGNClptmvVjcwgGwoZlea769JZz6YK6A/xh+ppega+BrBqgpdzgEPQuQMhWf/L pOxbgpkmdOpDaa6RP5zK1nsBi7WgVY7ySkHsnTKb7nxhyHv9+fgt/3N7sdSowSQWLOY+ FKNxYmrqqTSq8gNzvLUjy/Vm8Yxpcd+4/i0uOp1g1rofUkNcpwn9Ovcg0/xMr9HpIKdA ZUEFAge5p2VKd1bJaNnKDd7XHd6+1ZQd+uqkNd9eJZn0UgU/9+YJrFgpcS9QuwdiGMHZ rlYoATfdqat+8cyTa95X/SmshhKJuz/hiIAKac/z3ZM03+oqDN3EYlV8odv/0IL9duPl ka/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L6xXP0lk; spf=pass (google.com: domain of linux-kernel+bounces-19131-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19131-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id pc14-20020a17090b3b8e00b0028cc4f86bc2si5306813pjb.145.2024.01.07.23.10.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 23:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19131-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L6xXP0lk; spf=pass (google.com: domain of linux-kernel+bounces-19131-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19131-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F28A2281CDC for ; Mon, 8 Jan 2024 07:10:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 333848C06; Mon, 8 Jan 2024 07:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="L6xXP0lk" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA2FF8825; Mon, 8 Jan 2024 07:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704697810; x=1736233810; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=q3BRi1LuTFgEqMrhuwxfEP3vKCswFiyIHpRV1gihFhM=; b=L6xXP0lk3qlMzh2n87B5S0umzzUebvtP4mFRjweSiJ5zB/BjlXwDzeBD AWkbMoisywCcpnZ8AEmI2rHsvMyO3pX3RfEvCZd1NbIYLESVd+eVZ4pP9 yQYlZivorQ7iPdmmJWc2s9D3mHk+hOlFdw/j+IfNYXP7fFiywsiy2ofFg 5kzoZPR9mi+l4b6Ft5Y5MJP3XJjqqLw0GIWYpwjYwFz6hdpABj3J7x5Dy sfzeZjLioP2msP85n/aFo5Anzn7herBrtTjekP8DAqKpDrgLeytro2xpb 0OFxBPh731jxK+Pa8Re08rIwsMLpd+7V2xb62E1eEzo5gRE2Gqfm9lm/K A==; X-IronPort-AV: E=McAfee;i="6600,9927,10946"; a="4570333" X-IronPort-AV: E=Sophos;i="6.04,340,1695711600"; d="scan'208";a="4570333" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2024 23:10:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10946"; a="1028315259" X-IronPort-AV: E=Sophos;i="6.04,340,1695711600"; d="scan'208";a="1028315259" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2024 23:10:03 -0800 From: "Huang, Ying" To: Gregory Price Cc: Gregory Price , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Srinivasulu Thanneeru Subject: Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving In-Reply-To: (Gregory Price's message of "Fri, 5 Jan 2024 02:25:28 -0500") References: <20231223181101.1954-3-gregory.price@memverge.com> <8734vof3kq.fsf@yhuang6-desk2.ccr.corp.intel.com> <878r58dt31.fsf@yhuang6-desk2.ccr.corp.intel.com> <87mstnc6jz.fsf@yhuang6-desk2.ccr.corp.intel.com> <875y09d5d8.fsf@yhuang6-desk2.ccr.corp.intel.com> <87cyugb7cz.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Mon, 08 Jan 2024 15:08:05 +0800 Message-ID: <87mstg9uay.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Gregory Price writes: > On Fri, Jan 05, 2024 at 02:51:40PM +0800, Huang, Ying wrote: >> > >> > So we're talking ~1MB for 1024 threads with mempolicies to avoid error >> > conditions mid-page-allocation and to reduce the cost associated with >> > applying weighted interleave. >> >> Think about this again. Why do we need weights array on stack? I think >> this is used to keep weights consistent. If so, we don't need weights >> array on stack. Just use RCU to access global weights array. >> > > From the bulk allocation code: > > __alloc_pages_bulk(gfp, node, NULL, node_pages, NULL, page_array); > > This function can block. You cannot block during an RCU read context. Yes. You are right. For __alloc_pages_bulk(), it should be OK to allocate the weights array. For weighted_interleave_nid(), we can use RCU to avoid memory allocation in relative fast code path. BTW, we can use nr_node_ids instead of MAX_NUMNODES if applicable. -- Best Regards, Huang, Ying