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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D90C433DB for ; Thu, 25 Feb 2021 18:26:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6100064E6C for ; Thu, 25 Feb 2021 18:26:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6100064E6C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CC8456B006C; Thu, 25 Feb 2021 13:26:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C78326B006E; Thu, 25 Feb 2021 13:26:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8E138D0001; Thu, 25 Feb 2021 13:26:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id A2ECD6B006C for ; Thu, 25 Feb 2021 13:26:06 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 672BE1803F7B5 for ; Thu, 25 Feb 2021 18:26:06 +0000 (UTC) X-FDA: 77857619532.24.7A2034F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 1E58F2000392 for ; Thu, 25 Feb 2021 18:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614277564; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=45c6m4WbZCO0Bg89FJQVNFjxCGLWSobx/9ATf/zrYMM=; b=D9cl5xjsEUDO5yBUOYR3OTgNYwNseqxiCGCEkXqOy0v6Y8V4fG4lU5dqbw1izfqqzyOEsA aAi/xF/DctmeeonhCwGSyriIgf7GxxpZAE3d+z5in+0qtGrWYYJcNG7QTgKFsZJfylKyfh N11hLhyKAj1s8WF5ANrOwira/2gm5Vo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-NoCWPi4jPs6Qqiz8EuT6PQ-1; Thu, 25 Feb 2021 13:26:02 -0500 X-MC-Unique: NoCWPi4jPs6Qqiz8EuT6PQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A18A018B9EC3; Thu, 25 Feb 2021 18:26:00 +0000 (UTC) Received: from [10.36.114.58] (ovpn-114-58.ams2.redhat.com [10.36.114.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE1395C224; Thu, 25 Feb 2021 18:25:58 +0000 (UTC) Subject: Re: [PATCH v2 3/7] mm,memory_hotplug: Add kernel boot option to enable memmap_on_memory To: Oscar Salvador , Andrew Morton Cc: Michal Hocko , VlastimilBabkavbabka@suse.cz, pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Anshuman Khandual References: <20210209133854.17399-1-osalvador@suse.de> <20210209133854.17399-4-osalvador@suse.de> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <02041ab3-dcbd-9056-5571-48b84f527e42@redhat.com> Date: Thu, 25 Feb 2021 19:25:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210209133854.17399-4-osalvador@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1E58F2000392 X-Stat-Signature: 1rrjy68ca96uru7uourrwjiyoh4wzqww Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614277564-841476 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: > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 9bcc460e8bfe..95695483a622 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -42,7 +42,31 @@ > #include "internal.h" > #include "shuffle.h" > > -static bool memmap_on_memory_enabled; > +/* > + * memory_hotplug.memmap_on_memory parameter > + */ > +static bool memmap_on_memory_enabled __ro_after_init; > + > +static int memmap_on_memory_show(char *buffer, const struct kernel_param *kp) > +{ > + return sprintf(buffer, "%s\n", > + memmap_on_memory_enabled ? "on" : "off"); > +} > + > +static __meminit int memmap_on_memory_store(const char *val, > + const struct kernel_param *kp) > +{ > + /* > + * Fail silently in case we cannot enable it due to platform constraints. > + * User can always check whether it is enabled or not via /sys/module. > + */ > + if (!IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE)) > + return 0; > + > + return param_set_bool(val, kp); > +} > +module_param_call(memmap_on_memory, memmap_on_memory_store, > + memmap_on_memory_show, &memmap_on_memory_enabled, 0400); Why are other users not allowed to read? > Might want to add a MODULE_PARM_DESC(). As we fail silently already, I'd keep it simple and use a module_param(memmap_on_memory, bool, 0444); moving the IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE) into the runtime check. Apart from that LGTM. -- Thanks, David / dhildenb