From patchwork Sun Jul 30 15:16:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13333453 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 B9E3FC001E0 for ; Sun, 30 Jul 2023 15:16:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23E498D000A; Sun, 30 Jul 2023 11:16:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1795A900002; Sun, 30 Jul 2023 11:16:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E96E98D000C; Sun, 30 Jul 2023 11:16:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D488F8D000A for ; Sun, 30 Jul 2023 11:16:15 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AA3E41C8D44 for ; Sun, 30 Jul 2023 15:16:15 +0000 (UTC) X-FDA: 81068629110.09.8BB91D6 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by imf30.hostedemail.com (Postfix) with ESMTP id D4B1280007 for ; Sun, 30 Jul 2023 15:16:13 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Vg/2oAVG"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf30.hostedemail.com: domain of usama.arif@bytedance.com designates 209.85.128.41 as permitted sender) smtp.mailfrom=usama.arif@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690730173; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LjF+zN6TJ1BvEvRrI5C4CD8rIkkkthqR+fjsUt4Q8CQ=; b=Y+NGAGwGzs0+F0uqi+vnncjrsEykINJYPE4jSTQzlyDJfWTiN0YQWVA3K5e/btXuPIX1sF 2Q4R3orjEHAsKd0c3v+5A2FSVAp3U5FHdLoEj0I2H6nXFE4GwcXvSd9frgvvLDKQyeo42T bixQIPFQT0UmeVCeO77eXwHXmjimklI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Vg/2oAVG"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf30.hostedemail.com: domain of usama.arif@bytedance.com designates 209.85.128.41 as permitted sender) smtp.mailfrom=usama.arif@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690730173; a=rsa-sha256; cv=none; b=0KDCA8Cwe5Ke47Nx2UQvcmlMeZuJSry7naY5QgWq4Z8Ydmy8oD8kfg5eG1YfDqlDi93Rrt NC5DhOFAt7+iLD63s/3SrX0wVEcJl7csacEAlk+f/gYprM+yPDDnaNB7zi1asmkrnjDH1b 3k9IZiu/Y2aQey+0gOeb3trR88R5uSg= Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3fe167d4a18so14344255e9.0 for ; Sun, 30 Jul 2023 08:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690730172; x=1691334972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LjF+zN6TJ1BvEvRrI5C4CD8rIkkkthqR+fjsUt4Q8CQ=; b=Vg/2oAVG+oc700uPemJAECQqoZhvkHC4+v5G5umPPiGRagPclA/x9n9QgA5SDk8rdg xAP9ReHyrkmHzKD+QCBzbqzaesJvP/4YCVXhkUBDq7oFIh6fXXlQ/W6sesudYok3JgtG i8bNtt0JeBjQ7J+lYkbC40TeksYu8cuU6k1rZccXxVLpTekSilTdDcASxORLzoJggl+u dRvUz2KpmJ9ZuYWecFzFZAf1jF7ZS6Fe1gbbhfyhcMe2hud5pyNq2/bry4VpryWWF7x9 5XjSiGdDOVXVOjoB9TsdMcNi/ewnPLEIYUwh7l9m4DJjOtr0WmlRT+SiTcjbgC7BRS1N Zt9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690730172; x=1691334972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LjF+zN6TJ1BvEvRrI5C4CD8rIkkkthqR+fjsUt4Q8CQ=; b=CqarMMI/dsD4oeAy9m3bHokbqktYm6qeDTXMyiqkxltNGJG6BJ8qgGSm1TYlU/An+Q iQpLUziwTurTDRiNy81HanRfvA15/eipqaTahKKzvTsbpwNV6crKgYo29AP20c45EOjK dEMuwbveueGXDQqvcG6D4kAsxb7nU7U1lFyvDEiFQNL7A88bTG1JryW8VLR2UguZUwHM 5v5tcuqWUTl7p6p4GQ1mu9vCfEI2h+hZgab+/FJSLq3Kj37/faGKA8UiHpiD7ZtDSVbm Ei6+51uph78lRvFmKDxv1d5c2RodkXPhJ+ljLDOOI5vY5W2WQjPEoRHkvnWg0200xQOV BZvA== X-Gm-Message-State: ABy/qLY61pVCWNeS73FYGN6HT1y9Rgtcv9JQ+0//KsfEumdsxu7NXjSD cAXI10+Es88WFz+Oef0C2Fo6q81Acw0lQ2aWd4M= X-Google-Smtp-Source: APBJJlEBTcG9vQb7sO+eVhsdznDus6PkQqwHLouS3PQ0kKj5rr+MyIEAIBdbHeu9lJsdSY/4wUqiMA== X-Received: by 2002:a7b:c450:0:b0:3fb:c990:3b2 with SMTP id l16-20020a7bc450000000b003fbc99003b2mr5960153wmi.34.1690730172214; Sun, 30 Jul 2023 08:16:12 -0700 (PDT) Received: from localhost.localdomain ([2a02:6b6a:b465:0:eda5:aa63:ce24:dac2]) by smtp.gmail.com with ESMTPSA id f17-20020a7bcc11000000b003fd2d33ea53sm9123027wmh.14.2023.07.30.08.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jul 2023 08:16:11 -0700 (PDT) From: Usama Arif To: linux-mm@kvack.org, muchun.song@linux.dev, mike.kravetz@oracle.com, rppt@kernel.org Cc: linux-kernel@vger.kernel.org, fam.zheng@bytedance.com, liangma@liangbit.com, simon.evans@bytedance.com, punit.agrawal@bytedance.com, Usama Arif Subject: [v2 3/6] memblock: pass memblock_type to memblock_setclr_flag Date: Sun, 30 Jul 2023 16:16:03 +0100 Message-Id: <20230730151606.2871391-4-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230730151606.2871391-1-usama.arif@bytedance.com> References: <20230730151606.2871391-1-usama.arif@bytedance.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D4B1280007 X-Stat-Signature: uxz5kzp84nn35bu5c4wmyggsd8fuwqnn X-HE-Tag: 1690730173-787065 X-HE-Meta: U2FsdGVkX1/PPhJ47OskEEY1IC+c6SlvhLHq3yHtPh5qJ+CKWxaONG5AXxt23/o3VBO4vueLK7aX2RdIPvKspr3hV29ggIUbpZrKxe9nRfkausG88GBJLWo7cDW4Ff1LQbW/r97ZJ0G2PjDXh6/naKBfiso4W/iVYB184UlA21bX3VsH5F65yeHdaJlKoLzx/R/Oky3MrjcSg9NjYhMyog5mg9nV6dye68JCzgO/kJ7n1AaQ2xDIZvqhcy7uIdjyoCnJFI5PG6UaRkzUsqehj7RA7cEfQLx/EKj0tN43oPLeK3iM4+GaeXzM7QR6WQTPu8wgQNfs3HjnzNO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07PjjlusmEwVb2Z054MExVx4r+d4peEa+H1TIof77eVcIZldw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.001831, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This allows setting flags to both memblock types and is in preparation for setting flags (for e.g. to not initialize struct pages) on reserved memory region. Signed-off-by: Usama Arif --- mm/memblock.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index f9e61e565a53..43cb4404d94c 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -896,10 +896,9 @@ int __init_memblock memblock_physmem_add(phys_addr_t base, phys_addr_t size) * * Return: 0 on success, -errno on failure. */ -static int __init_memblock memblock_setclr_flag(phys_addr_t base, - phys_addr_t size, int set, int flag) +static int __init_memblock memblock_setclr_flag(struct memblock_type *type, + phys_addr_t base, phys_addr_t size, int set, int flag) { - struct memblock_type *type = &memblock.memory; int i, ret, start_rgn, end_rgn; ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn); @@ -928,7 +927,7 @@ static int __init_memblock memblock_setclr_flag(phys_addr_t base, */ int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size) { - return memblock_setclr_flag(base, size, 1, MEMBLOCK_HOTPLUG); + return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_HOTPLUG); } /** @@ -940,7 +939,7 @@ int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size) */ int __init_memblock memblock_clear_hotplug(phys_addr_t base, phys_addr_t size) { - return memblock_setclr_flag(base, size, 0, MEMBLOCK_HOTPLUG); + return memblock_setclr_flag(&memblock.memory, base, size, 0, MEMBLOCK_HOTPLUG); } /** @@ -957,7 +956,7 @@ int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size) system_has_some_mirror = true; - return memblock_setclr_flag(base, size, 1, MEMBLOCK_MIRROR); + return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_MIRROR); } /** @@ -977,7 +976,7 @@ int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size) */ int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size) { - return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP); + return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_NOMAP); } /** @@ -989,7 +988,7 @@ int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size) */ int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size) { - return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP); + return memblock_setclr_flag(&memblock.memory, base, size, 0, MEMBLOCK_NOMAP); } static bool should_skip_region(struct memblock_type *type,