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=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,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 A830CC433F5 for ; Mon, 20 Sep 2021 09:15:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DACC60F26 for ; Mon, 20 Sep 2021 09:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236889AbhITJQn (ORCPT ); Mon, 20 Sep 2021 05:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233243AbhITJQT (ORCPT ); Mon, 20 Sep 2021 05:16:19 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D56C061766 for ; Mon, 20 Sep 2021 02:14:53 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id f129so16678534pgc.1 for ; Mon, 20 Sep 2021 02:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=LWSCYEWJX2JBlRRFgmVEzcm5wBIbmnQM2030wXUM5lg=; b=X0RMsNLfBKlcPUtEqra8Vua+G5VEhY5cD0UAkxXJw4kajUW/CjLm+TtNaoO+QAkzjR UjXdaOzo7RwNcbtbewqfk1URygMaEXtiEXUh+hHhgreRpyaPqaaaaX7RpQo0LVPgpgaa /gUsB6hkq8ssjZSfE9BFE0jfHmF60FzJ7e3Klth/PSnfZ/SlSbdwxaiUv0fsa+NItIxc IcIr6XZS9IKnjCfTjpRQzzOQbGZcddSMNQDhg6NNgM2+UhURhh2OiGYoNqsxN810/oFJ u+X6JzOVABO1Rm1lSH+P5bg2oAdr7xAmLEenQcgNgZi7nWCY1KtY8gjaM99E11rm1oiC zeIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=LWSCYEWJX2JBlRRFgmVEzcm5wBIbmnQM2030wXUM5lg=; b=g1XdlSgcJE/S2ot3yUJpgQ3PMY9Pa/Tmo1NxsrUWNnzIV9qH05Uz8+PFl0QoTZa/jc 9KtOOtQzxZA5FcUGhF5hsmVNXgDUVTYWuRXhWEw+kX0M4JR+QluY401HyzmGmqbG1kH7 TLxTi85KLBbfNgP958JNwSfMXa8RNES9LUVL8djBBZAhiQAX2ii+crGxGzSg4rGHTFnC 91vv59CMsHUqvlW+F7VVeecevdBMX60rIpyncHY7WXSJtR+klTB0U4tGFiHfaRI5G5es g65jmbT0I4mlrYc/82j5MA20egGf3u7W+YWsyjQ+6FzUL9/Bi+UKVVvRcS5TFqXbCI52 VJjw== X-Gm-Message-State: AOAM530u4J4F47Qel5N8TsVe9NXlbxj1SuT2fTWJ96sowH5MrLx7yjEx xBv57rxViWEa9T67kRhTj0ahzWF5ij01YmM5 X-Google-Smtp-Source: ABdhPJzrsqpHKJQVypLMMnz7M/9djwWUWvrB4nqHCl3qNzhPlkvyUcPUEtbyMoEmUvsUmBFXL2SjXw== X-Received: by 2002:a05:6a00:1245:b029:30f:2098:fcf4 with SMTP id u5-20020a056a001245b029030f2098fcf4mr24275858pfi.66.1632129292226; Mon, 20 Sep 2021 02:14:52 -0700 (PDT) Received: from owniadeMacBook-Pro.local ([103.97.201.31]) by smtp.gmail.com with ESMTPSA id x71sm7916698pfc.146.2021.09.20.02.14.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 02:14:51 -0700 (PDT) Subject: Re: [PATCH] mm/debug: sync up latest migrate_reason to migrate_reason_names To: John Hubbard , "Huang, Ying" Cc: Andrew Morton , Pavel Tatashin , Oscar Salvador , Yang Shi , Zi Yan , Dave Hansen , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210917061432.323777-1-o451686892@gmail.com> <871r5nptt7.fsf@yhuang6-desk2.ccr.corp.intel.com> <89a06743-b37a-b85a-1c04-5d863a1d2cb4@gmail.com> <3cf9bb7f-618e-4e4b-32d6-4d3c207b9a9a@nvidia.com> From: Weizhao Ouyang Message-ID: Date: Mon, 20 Sep 2021 17:14:48 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/19 13:38, John Hubbard wrote: > On 9/18/21 00:03, Weizhao Ouyang wrote: > ... >>   Anyway, I didn't find a simply way the build the "everywhere" relationship behind >> the packaged TRACE_DEFINE_ENUM , what do you think. >> > It's actually pretty easy, unless I'm unknowingly violating some rule > here. But I did review tracing a bit before diving in, and I think this > is reasonable. > > The trace macros EM(), EMe(), and MIGRATE_REASON are flexible enough to > get whatever you want, out of them. So, the trace header can be the one > location for the definition of the enum-to-string mapping. > > The key is to move the enum to a common header file that both the trace > system (trace/events/migrate.h) and the migrate header > (include/linux/migrate.h) can include. Fortunately, that's already been > started for enum migrate_mode: there is migrate_mode.h. > > So it all works approximately like this, below. (I'll attach a > white-space-correct diff that you can apply directly, too). I've > compiled tested and rebooted with it, but haven't checked much more > than that yet. Thanks for your detailed patch! Yeah, if we move the enum migrate_reason to another header file it will attach it easily. The previous mail I said the tricky point is that we build the "everywhere relationship" on the basis of maintaining the original file structure, sorry for the confusing misleading. I think we should not change a lot for a slight synchronization. For now we can just apply the update in migrate_reason_name(maybe leave a comment to notify) on this patch, I will send v2 patch soon include the "cma" update. As for the trace_event synchronization, we can figure out a more generic implementation in the future, so that other subsystem can use it to catch a string info from its trace event header. Thanks, Weizhao