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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 8DBDAC2D0DB for ; Thu, 30 Jan 2020 22:23:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E0212083E for ; Thu, 30 Jan 2020 22:23:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MU4zk4tg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E0212083E 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 D5D1B6B0399; Thu, 30 Jan 2020 17:23:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CE5646B039A; Thu, 30 Jan 2020 17:23:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAF336B039B; Thu, 30 Jan 2020 17:23:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id A208F6B0399 for ; Thu, 30 Jan 2020 17:23:10 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5B0EA3AB9 for ; Thu, 30 Jan 2020 22:23:10 +0000 (UTC) X-FDA: 76435727340.28.burn86_9011f3bc9e34d X-HE-Tag: burn86_9011f3bc9e34d X-Filterd-Recvd-Size: 4042 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 30 Jan 2020 22:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580422989; h=from:from:reply-to: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=BzIeIqRq/6d1bUtukwLg3EQ9KyVmZHQdTkxNQ8aczgA=; b=MU4zk4tg1OdQw2wh1sHn1F2pryTR1peZtj0W3qwDOQM6rK7hVEOl2CDbvApCT/dHuZ+Sjn gFqRbRDqrEChW0EQLds3B7UwL6mNeC76O2MeApbhC2CHMfbyWhT2duuRteMtwNeizI/4Vb d5VCGCWysap069O6G0Lrsr3k+jpyCtw= 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-378-neXYgf7IPSqM4nqLFttLew-1; Thu, 30 Jan 2020 17:23:02 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6D98BF0D1; Thu, 30 Jan 2020 22:23:01 +0000 (UTC) Received: from localhost.localdomain (vpn2-54-25.bne.redhat.com [10.64.54.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 421E077939; Thu, 30 Jan 2020 22:22:58 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH 0/3] mm: Rework {enabled,defrag}_{show,store} To: Vlastimil Babka , Michal Hocko Cc: linux-mm@kvack.org, aarcange@redhat.com, akpm@linux-foundation.org, David Rientjes References: <20200130022441.95488-1-gshan@redhat.com> <20200130074901.GR24244@dhcp22.suse.cz> <4eb439e9-fd36-dd72-46fd-957abae98f9b@suse.cz> From: Gavin Shan Message-ID: Date: Fri, 31 Jan 2020 09:22:55 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <4eb439e9-fd36-dd72-46fd-957abae98f9b@suse.cz> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: neXYgf7IPSqM4nqLFttLew-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: On 1/30/20 8:46 PM, Vlastimil Babka wrote: > On 1/30/20 8:49 AM, Michal Hocko wrote: >> On Thu 30-01-20 13:24:38, Gavin Shan wrote: >>> The inappropriate settings can be accepted by "enabled" and "defrag" >>> interface, as the following example shows. This series reworks the >>> related functions and fixes the issue by the way. >> >> Do we really care? This is a root only interface and we do expect root >> to know how to use the interface. > > Also I think David already solved even this case with sysfs_streq() that > Andrew suggested: > > https://lore.kernel.org/linux-mm/alpine.DEB.2.21.2001171411020.56385@chino.kir.corp.google.com/ > Thanks for the linker. I didn't notice there already have a patch to address the issue. Also, I perhaps post patch to improve the extendibility on top of David's patch if you agree. Otherwise, it can be ignored. By the way, it's nice to know sysfs_streq(). Thanks, Gavin >>> # cat /sys/kernel/mm/transparent_hugepage/enabled >>> always [madvise] never >>> # echo neveroff > /sys/kernel/mm/transparent_hugepage/enabled >>> # cat /sys/kernel/mm/transparent_hugepage/enabled >>> always madvise [never] >>> >>> Gavin Shan (3): >>> mm: Rework {enabled,defrag}_store() >>> mm: Rework {enabled,defrag}_show() >>> mm: Rework setup_transparent_hugepage() >>> >>> mm/huge_memory.c | 216 +++++++++++++++++++++++++++-------------------- >>> 1 file changed, 125 insertions(+), 91 deletions(-) >>> >>> -- >>> 2.23.0 >>> >> >