Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp3571869rwb; Sun, 30 Jul 2023 10:32:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlGhD8T4RcMIR/fqEtlTXqL7UGyJGOhzh56wNEyP8RlFwqR/iRI1AwIvwbHC9TjpbvD0G5Da X-Received: by 2002:a17:902:7b8a:b0:1b5:49fc:e336 with SMTP id w10-20020a1709027b8a00b001b549fce336mr5864408pll.42.1690738352297; Sun, 30 Jul 2023 10:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690738352; cv=none; d=google.com; s=arc-20160816; b=fzzpCTSDvOX5JKo4tE7GNCt0CHrnaAAO7Tchr3l+3qOb+LBgHRi3V0Ko5Yoqs8fRAT KVoYhZNXdyfRMCrkafspHrPNUQWVRRTbjPyZvLVISoFzPS3nrP08nRuPNSVIb5jUxvtz B1xEBekv1+PTpHJMA0TwAUUcaZnJxxppM1lrHn1mUrOzDDJZC3WtWSmx4KgS+NxofBYZ JWxX4bH7DgvhCt2xp5lEGk5ypGVXAkRQpwxNsLY940uvP/aoV68rStBhRX2k/p/CTGzv rq31PVb3wv8XypqzawfTPqth/ZaqEPBwKDgOhMl3uxxCGjuxxXB0/cZMvCdEB92WpZA0 xsbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LjF+zN6TJ1BvEvRrI5C4CD8rIkkkthqR+fjsUt4Q8CQ=; fh=6ywE3cadAEHt3CqWKbi2najT+v0c7si89uhbZ0SfPzA=; b=ZQF3Z/tNc/k5uHyrY7zt1jOQ5MpebdUU8Hp7dMuQGNe70V3CYcQ6UwtyNJcJYkKkUb Y5YKMWA8QylpAheG0J/+zatIs66fjNYGOg/ucl2lYxdy9YEMNDlGxGZ5D3Lmx1OMvAZN v4axSyRQ11vQgO4eHmi0WJoK3PhEl+OEJ8JaOk0QUo1p3IO5g3CxLL1OCJyNAS0Wfz6I PUKy2I0xPYD6mQGlVOCnxiEtmRPYf9eqJey2PihCIuqa8BFYIyYPRAzFYibypUB5eSis YcpnwWohbZZFyVidXfX6VbFzAqvbwlhpaWOkOQvZ8kLKOgE2K7Kyv+OEqOID7Hi/ZqgU 7Uzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="Vg/2oAVG"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp9-20020a170902e78900b001b8a7521b5csi5957480plb.244.2023.07.30.10.32.18; Sun, 30 Jul 2023 10:32:32 -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=@bytedance.com header.s=google header.b="Vg/2oAVG"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbjG3PQQ (ORCPT + 99 others); Sun, 30 Jul 2023 11:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjG3PQO (ORCPT ); Sun, 30 Jul 2023 11:16:14 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C5F3138 for ; Sun, 30 Jul 2023 08:16:13 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fba8e2aa52so42188475e9.1 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=a1u51rrFCKwhbysKj25kUQzqMgF1p+lTpRpo/E+2EreLrDNo4by/xnIEI71kLJDM3Y ekrAw3Y4BhzlFyyO2/YUfqmAO7PvAaPBGDOND+z51YTcYjV3S4VOvZhbBMd4Hfi7Mmi8 pwKbeC83i6YGYdDi8a+YcBeMib+H+K74fSlhm49KUQP3qSKDDdvMAhD7B5JMpnWHRz11 U5XPINj2A6CYAKtH9w1Bl4wubqJkwkByee6aHMJB4iXV3hwymBnDKUahszwKcodfj6pJ VIRcNPdHm3X/UTYLZr/BiuT36shaDodImA03BjZQ7LkGFvKhbKhoPCPT3NNCkoDQDFq5 ad0Q== X-Gm-Message-State: ABy/qLbOPXSMQ2MAtfcqdkcpBphnzHeod0VAc3dEUiKiLtLkiZ3IdohO WzQD8C88niBY4LOJAImguKcpGg== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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, -- 2.25.1