From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754609AbcIAA2a (ORCPT ); Wed, 31 Aug 2016 20:28:30 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34833 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754052AbcIAA23 (ORCPT ); Wed, 31 Aug 2016 20:28:29 -0400 Date: Wed, 31 Aug 2016 17:28:26 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Reza Arbab cc: Andrew Morton , Greg Kroah-Hartman , Vlastimil Babka , Vitaly Kuznetsov , Yaowei Bai , Joonsoo Kim , Dan Williams , Xishi Qiu , David Vrabel , Chen Yucong , Andrew Banman , Seth Jennings , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH v2] memory-hotplug: fix store_mem_state() return value In-Reply-To: <20160901001751.m3z2snlop2djzqgd@arbab-vm> Message-ID: References: <20160831150105.GB26702@kroah.com> <1472658241-32748-1-git-send-email-arbab@linux.vnet.ibm.com> <20160831132557.c5cf0985e3da5f2850a10b1d@linux-foundation.org> <20160831233811.g6kf24fdhnfhn637@arbab-vm> <20160901001751.m3z2snlop2djzqgd@arbab-vm> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Aug 2016, Reza Arbab wrote: > > Nope, the return value of changing state from online to online was > > established almost 11 years ago in commit 3947be1969a9. > > Fair enough. So if online-to-online is -EINVAL, online-to-online for state is -EINVAL, it has been since 2005. > 1. Shouldn't 'echo 1 > online' then also return -EINVAL? > No, it's a different tunable. There's no requirement that two different tunables that do a similar thing have the same return values: the former existed long before device_online() and still exists for backwards compatibility. > 2. store_mem_state() still needs a tweak, right? It was only returning -EINVAL > by accident, due to the convoluted sequence I listed in the patch. > Yes, absolutely. It returning -EINVAL for "nline" is what is accidently preserving it's backwards compatibility :) Note that device_online() returns 1 if already online and memory_subsys_online() returns 0 if online in this case. So we want store_mem_state() to return -EINVAL if device_online() returns non-zero (this was in my first email). From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f200.google.com (mail-ua0-f200.google.com [209.85.217.200]) by kanga.kvack.org (Postfix) with ESMTP id 35B4E6B0038 for ; Wed, 31 Aug 2016 20:28:29 -0400 (EDT) Received: by mail-ua0-f200.google.com with SMTP id j4so142535927uaj.2 for ; Wed, 31 Aug 2016 17:28:29 -0700 (PDT) Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com. [2607:f8b0:400e:c03::22a]) by mx.google.com with ESMTPS id kv2si2340068pab.145.2016.08.31.17.28.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2016 17:28:28 -0700 (PDT) Received: by mail-pa0-x22a.google.com with SMTP id cy9so23513884pac.0 for ; Wed, 31 Aug 2016 17:28:28 -0700 (PDT) Date: Wed, 31 Aug 2016 17:28:26 -0700 (PDT) From: David Rientjes Subject: Re: [RESEND PATCH v2] memory-hotplug: fix store_mem_state() return value In-Reply-To: <20160901001751.m3z2snlop2djzqgd@arbab-vm> Message-ID: References: <20160831150105.GB26702@kroah.com> <1472658241-32748-1-git-send-email-arbab@linux.vnet.ibm.com> <20160831132557.c5cf0985e3da5f2850a10b1d@linux-foundation.org> <20160831233811.g6kf24fdhnfhn637@arbab-vm> <20160901001751.m3z2snlop2djzqgd@arbab-vm> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Reza Arbab Cc: Andrew Morton , Greg Kroah-Hartman , Vlastimil Babka , Vitaly Kuznetsov , Yaowei Bai , Joonsoo Kim , Dan Williams , Xishi Qiu , David Vrabel , Chen Yucong , Andrew Banman , Seth Jennings , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Wed, 31 Aug 2016, Reza Arbab wrote: > > Nope, the return value of changing state from online to online was > > established almost 11 years ago in commit 3947be1969a9. > > Fair enough. So if online-to-online is -EINVAL, online-to-online for state is -EINVAL, it has been since 2005. > 1. Shouldn't 'echo 1 > online' then also return -EINVAL? > No, it's a different tunable. There's no requirement that two different tunables that do a similar thing have the same return values: the former existed long before device_online() and still exists for backwards compatibility. > 2. store_mem_state() still needs a tweak, right? It was only returning -EINVAL > by accident, due to the convoluted sequence I listed in the patch. > Yes, absolutely. It returning -EINVAL for "nline" is what is accidently preserving it's backwards compatibility :) Note that device_online() returns 1 if already online and memory_subsys_online() returns 0 if online in this case. So we want store_mem_state() to return -EINVAL if device_online() returns non-zero (this was in my first email). -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org