Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp801715ybg; Tue, 28 Jul 2020 20:36:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJpHTfwLUvhhYH3YPctDm7MafGepw114PTUwrbMEAvFb8/Ivv67X+pEwZi3CwHYhn8Rtzs X-Received: by 2002:a05:6402:158d:: with SMTP id c13mr29224667edv.103.1595993768073; Tue, 28 Jul 2020 20:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595993768; cv=none; d=google.com; s=arc-20160816; b=yoEAZeTLdviUGQicbSgE1Nad8XS6pgvD5l6+Blclrlht+CSilIHmrHYmxtr8NyogQU 9heCpkQZ6qAVt3Lf3/uEXgoShPk4iWD6yHpPZiF+6pAC5nECzn7rvbv4b7QZo6YQ5D1T 0ttVpWIqR6R//Qx+4zSRmnN3j+oxEy3DkUoUR0iwYUnoAsPj5Zb+k2a0xIm0wrDjEDap ASUl852bet6WJL+8MtBrsZUfFhXz8z7GqVaRUKoymOVQZpJKETWvZ09xkiJo3pmkxjRT kEfx+GD0rBSYwveC2si2Gng0pqnsiuv4i+0ZsSVRXNJdoXI70qvEh0YCQ9kRdUkJlSnH lNCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=3fo2lw5asYYnrfdzR5jZNH58HoqFY3asDdESXoPkVhc=; b=K3f2EOGnoHoAPLe7x7qvqnj3oFhIuFqvW62+/XFlz+btsJFDqwlYW7qyeXpGsK5UhV VTCryCPyrihphGUEVcnVd6Q0o9ljxu2cfV+byYk5v/01vETYjmBuE5rhEhh1UzaLAe7Y pJUqYKcV0fsjFxPAnq/gWTz5x47xwd0P1TEhzEByPVsd01HzIVIeh/N8n0zbZPLZnnMw Z2XmroIWyVoeR3UGpoSA8lTwMTn+W1UF8r4/LuYZYerPE4/NRWVt6Rs7jNr0EJX+PXB4 6boOL0tJ9QO5nLh9Xi1trWtMratUov6S3ft/X4Q99lNZjW+ZTxdNxXZE4VCjMhlaV9Jg zDaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si508522edf.434.2020.07.28.20.35.45; Tue, 28 Jul 2020 20:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgG2DfV (ORCPT + 99 others); Tue, 28 Jul 2020 23:35:21 -0400 Received: from foss.arm.com ([217.140.110.172]:44530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbgG2DfU (ORCPT ); Tue, 28 Jul 2020 23:35:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 288FB31B; Tue, 28 Jul 2020 20:35:20 -0700 (PDT) Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com [10.169.212.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AC23E3F66E; Tue, 28 Jul 2020 20:35:12 -0700 (PDT) From: Jia He To: Dan Williams , Vishal Verma , Mike Rapoport , David Hildenbrand Cc: Catalin Marinas , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Dave Jiang , Andrew Morton , Steve Capper , Mark Rutland , Logan Gunthorpe , Anshuman Khandual , Hsin-Yi Wang , Jason Gunthorpe , Dave Hansen , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org, Wei Yang , Pankaj Gupta , Ira Weiny , Kaly Xin , Jia He Subject: [RFC PATCH 1/6] mm/memory_hotplug: remove redundant memory block size alignment check Date: Wed, 29 Jul 2020 11:34:19 +0800 Message-Id: <20200729033424.2629-2-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200729033424.2629-1-justin.he@arm.com> References: <20200729033424.2629-1-justin.he@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The alignment check has been done by check_hotplug_memory_range(). Hence the redundant one in create_memory_block_devices() can be removed. The similar redundant check is removed in remove_memory_block_devices(). Signed-off-by: Jia He --- drivers/base/memory.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2b09b68b9f78..4a1691664c6c 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -642,10 +642,6 @@ int create_memory_block_devices(unsigned long start, unsigned long size) unsigned long block_id; int ret = 0; - if (WARN_ON_ONCE(!IS_ALIGNED(start, memory_block_size_bytes()) || - !IS_ALIGNED(size, memory_block_size_bytes()))) - return -EINVAL; - for (block_id = start_block_id; block_id != end_block_id; block_id++) { ret = init_memory_block(&mem, block_id, MEM_OFFLINE); if (ret) @@ -678,10 +674,6 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) struct memory_block *mem; unsigned long block_id; - if (WARN_ON_ONCE(!IS_ALIGNED(start, memory_block_size_bytes()) || - !IS_ALIGNED(size, memory_block_size_bytes()))) - return; - for (block_id = start_block_id; block_id != end_block_id; block_id++) { mem = find_memory_block_by_id(block_id); if (WARN_ON_ONCE(!mem)) -- 2.17.1