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 80D5BC61DA4 for ; Fri, 24 Feb 2023 14:52:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E82B66B0071; Fri, 24 Feb 2023 09:52:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0C366B0073; Fri, 24 Feb 2023 09:52:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CABEE6B0074; Fri, 24 Feb 2023 09:52:41 -0500 (EST) 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 B33AB6B0071 for ; Fri, 24 Feb 2023 09:52:41 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7AB60A06F6 for ; Fri, 24 Feb 2023 14:52:41 +0000 (UTC) X-FDA: 80502476922.18.781CD68 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf11.hostedemail.com (Postfix) with ESMTP id A0D7C4001F for ; Fri, 24 Feb 2023 14:52:39 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WuayLX8T; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677250359; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XUnNThrD/0ya4Ea/SSJNwK7k6zLjrMn2bilqSfWaUsc=; b=EK+uddGYqv3b/6zyd/9IjZwqAFZVnLaOu7WbEmYZtC0LR7qzUAA+yaoOITJ7uJygX52fx2 z1cKWaOAOXD63V1S4ygyuU+JsOk2OSHVwbnIufIYNngWDhdhFEgCo0mAryIQjehElclSP2 HiWOXBWscp1j2hqd8q0xzeOuhoMHVqc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WuayLX8T; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677250359; a=rsa-sha256; cv=none; b=MK4ODeBq9Pn02n+Q+JRTS6Ykk7Apin9BziOibGW1SOxWKP9EJ4Iu5jz6hluI/SELnTuuct FZSMQul7yRQ5Lk6e3ae4bjjZJquyHO/2V3dPcOJbCGH4SETzKh+k9kAo0Iy0HLNVZ8dcpJ xLO9pnZaDejWqKr7GwMHrYZ3/vLWR3U= 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 23D1FB81BF2; Fri, 24 Feb 2023 14:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AEF9C433D2; Fri, 24 Feb 2023 14:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677250356; bh=88jg955Xlrfjz0cdpx93zZt+1vg7t0UtMpUiq72/y20=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WuayLX8T11FBApVctgpEi4iszLEZbC2I6zuVpzQ1lROGYa395L2A7EvStSF7LQxP9 OYIliXyzfsSQuqYGcqzcGHiIjeruOZ56spgNEjHEI7tlVoxujKYnbnEEdtFR7w8Gpj NNGzX/a4Wi+ZhoPO6sB6i077FQM/EClwXuZAZuPahGvPAKxYFfo9xeyuYVPlUxundc bl97rVN929h+OFrKUJRa2dGILgG4rkYo4Dv8WEGujH6Tg2FvE40K+Bys9zwAex5K0M Lf4XEmemjnIfJhhnzQ3jwx8WPgkGcke0hxn6LRoPAxmlyMQ2fzXx9k2JsIWaHHw6o4 bOb/7wNaxaLcw== Date: Fri, 24 Feb 2023 16:52:26 +0200 From: Mike Rapoport To: Claudio Migliorelli Cc: remckee0@gmail.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] Add tests for memblock_alloc_node() Message-ID: References: <59d4745b-7b2-bf6-7b8-f6571d78d336@mail.polimi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59d4745b-7b2-bf6-7b8-f6571d78d336@mail.polimi.it> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A0D7C4001F X-Stat-Signature: jxhtzj1t8g5oejhnmwfkuqjqxunhn48c X-Rspam-User: X-HE-Tag: 1677250359-250178 X-HE-Meta: U2FsdGVkX18JK6PdPnKLE6AZDKbhMdjxi1rO+SvOLDFCW4Q7F3rwDw2KmJeJGBo2tm1gzmXN9+CwEcsjW4YeSGJJ4RmtzZUiWhjFjRDqtohi4aYapL2C/vXKYUJuKyqZPmXi1U+SrU1ehsAX+m9YY0LNWGGV4D6ZH8vqq8fV8u1+FOOPhKGVkhgVKLVNbdVQoSYOcYXj8oSbnP7xfk5mgO9N0gV5zpHB/8Km7TiDsawRZ9IURH5xdNilAux+UEMMMYorP7L2m7WfBpIH8rL1jLFYOYSAFRO5b06GZh8v98P1CSLijmJOXXq6ZtZNq7uGvg5QeLaeie4m5thMuuoXzFuJj7JJhDjKg8Uwroq92MwI7eEBlnKNN8QaYhnmmjNizosqPH+ONXfTnoE25LxVmzX4k+HiAVs4QgZ+WLwVxFesXuhk/zSrcUzMA20aL4ofQF8gypX4UMAfq7RGUy5vvgxibVEafegeKjw2YQ+r9thnQJ8vaFi9niSzFBU4ZoBxrbZSkNlGNPlET2nULU28Tdn9FkKgEmPUbQ2EHR+fg1W4rurGf+iUYI5gRqOhT6McRWZGvxrZislk1qrzdiH5GMrdJzdilxwWJXRPblR3o+9os00u3w48ri1LGoj30LiOA7Pf/delZiESlQ/hehgxKagYZSpLAdYt+/0jkmUdreNeZcQrST2PkY/YKVebBdibhbVO5U3Ht5mM0vP1rglwRHoV9kN2riLrm6MFbTBvobQ3Kkltb0fnsr/GEssWEnyptYrN8vw0kdGrri/4RJpBZSLp1PbAH1Wz0GCPCPviggIG01V0xm1XtrvDjbg2eXSxsE6SgOGpZCIFJ1Mp6jod5/VGN5bFzSoeboZ5SDP5TeCWauO6RlTHPwSpUcMWS4XIWBHdTfCW4x/VWucRpVF8jl0hPdyTfEtrJjF4Wy2Ui5WVu1UQzb5mlDzvQ/xY88iUXFiNCuva34zDLriq0in xkj1PjxS N/rSDZVIbCCzwN/qudFIxU0WKYpSwQhWpHRjnyKZZwxVJyB+1zGSG+7CEOz7uphxOx6qdbRMaazdA6K9otpSoRESnGuTtW0ANa07N2e2IY5k95z+BC4DZ+SR8oJoALd3+6GpANj1C0MGyNsu/r4PJj3FFIM3UUR0y+8exC0jXBuQflZ6ezLARn4k+G8PdZn6tcxZyNyUsQlp/Js1c57gkMAmxYfWMORPxcMddBNHTmbR1KICcCFeDb1hDFNQJ5ed0xJqKjMBgKwBPQLUmarI2gTnqHzVcEj4X1WZsid0RSzNK+4aTCnFpb95ofOTWazW4EagPrEz4LeEEeecS4zR4DgmGEc9AkbpzygFJ 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: Hi Claudio, On Sun, Feb 19, 2023 at 05:28:46PM +0100, Claudio Migliorelli wrote: > This test is aimed at verifying the memblock_alloc_node() to work as > expected, so setting the correct NUMA node for the new allocated > region. The memblock_alloc_node() is called directly without using any > stub. The core check is between the requested NUMA node and the `nid` > field inside the memblock_region structure. These two are supposed to > be equal for the test to succeed. > > Signed-off-by: Claudio Migliorelli > --- > Changelog: > ---------- > v2: > - Use the memblock_alloc_node() directly without mimicking it > > tools/testing/memblock/tests/alloc_nid_api.c | 40 ++++++++++++++++++++ > 1 file changed, 40 insertions(+) When I tried to apply your patch I've got these errors: :188: trailing whitespace. error: patch failed: tools/testing/memblock/tests/alloc_nid_api.c:2494 error: tools/testing/memblock/tests/alloc_nid_api.c: patch does not apply > diff --git a/tools/testing/memblock/tests/alloc_nid_api.c b/tools/testing/memblock/tests/alloc_nid_api.c > index 49ef68cccd6f..975a5317abf3 100644 > --- a/tools/testing/memblock/tests/alloc_nid_api.c > +++ b/tools/testing/memblock/tests/alloc_nid_api.c > @@ -2494,6 +2494,35 @@ static int alloc_nid_numa_split_all_reserved_generic_check(void) > return 0; > } > > +/* > + * A simple test that tries to allocate a memory region through the > + * memblock_alloc_node() on a NUMA node with id `nid`. Expected to have the > + * correct NUMA node set for the new region. > + */ > +static int alloc_node_on_correct_nid(void) > +{ > + int nid_req = 2; > + void *allocated_ptr = NULL; > +#ifdef CONFIG_NUMA > + struct memblock_region *req_node = &memblock.memory.regions[nid_req]; > +#endif > + phys_addr_t size = SZ_512; > + > + PREFIX_PUSH(); > + setup_numa_memblock(node_fractions); > + + allocated_ptr = memblock_alloc_node(size, SMP_CACHE_BYTES, nid_req); > + > + ASSERT_NE(allocated_ptr, NULL); > +#ifdef CONFIG_NUMA > + ASSERT_EQ(nid_req, req_node->nid); > +#endif > + > + test_pass_pop(); > + > + return 0; > +} > + > /* Test case wrappers for NUMA tests */ > static int alloc_nid_numa_simple_check(void) > { > @@ -2632,6 +2661,15 @@ static int alloc_nid_numa_split_all_reserved_check(void) > return 0; > } > > +static int alloc_node_numa_on_correct_nid(void) > +{ > + test_print("\tRunning %s...\n", __func__); > + run_top_down(alloc_node_on_correct_nid); > + run_bottom_up(alloc_node_on_correct_nid); > + > + return 0; > +} > + > int __memblock_alloc_nid_numa_checks(void) > { > test_print("Running %s NUMA tests...\n", > @@ -2652,6 +2690,8 @@ int __memblock_alloc_nid_numa_checks(void) > alloc_nid_numa_reserved_full_merge_check(); > alloc_nid_numa_split_all_reserved_check(); > > + alloc_node_numa_on_correct_nid(); > + > return 0; > } > > -- > 2.38.3 -- Sincerely yours, Mike.