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.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 B7F66C433EF for ; Mon, 20 Sep 2021 09:14:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 638B760F6F for ; Mon, 20 Sep 2021 09:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 638B760F6F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 02D2E900003; Mon, 20 Sep 2021 05:14:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1FA7900002; Mon, 20 Sep 2021 05:14:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE863900003; Mon, 20 Sep 2021 05:14:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id D0EBB900002 for ; Mon, 20 Sep 2021 05:14:53 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 91D2D181AEF3F for ; Mon, 20 Sep 2021 09:14:53 +0000 (UTC) X-FDA: 78607392066.38.3B53C2E Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf22.hostedemail.com (Postfix) with ESMTP id 5C3BC190D for ; Mon, 20 Sep 2021 09:14:53 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id t1so16689424pgv.3 for ; Mon, 20 Sep 2021 02:14:53 -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=tZUX/5t1KfZt7GURxSdlSRZ86G3IG3MpI7KLv0OcWVoWJLMV3g5d5Sm5M3y/9uxEhP 9bbQp1/vPDEdcTSHE4kpyIsswaamQXli3ndMHvtNyIxXU/OTZCMLJjON62hkyhkuK+Vs 6zSZ+4+mkc8IgLlltDBfZXKIh/m2uNkn0qweEidZM4dTgHLflg6MaSN9rnoL/fy93lC5 /CoPcVcAKq7iYAS01tE/lSYYFLN6Kc1Rh0ViPC0UDu/Rg5w6jkFjWHHG0HoOQOClepts KlMKBH8MEiXePVPvRbMnlHXflnwWG/Pga7bcXRFszPce+Jt8c9bbHzj9MutwKBWzLlMZ bQfw== X-Gm-Message-State: AOAM532JMfil1h+DHlqnh+BTXxEyjX1SqCwqS3IzXXhL86+LM/Iw1c7s x2NSkHh1QFqVUJjc5atY6Iw= 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-Language: en-US X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5C3BC190D Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=X0RMsNLf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of o451686892@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=o451686892@gmail.com X-Stat-Signature: 6zp3z193macxxjmrgsaojp4gg386iatn X-HE-Tag: 1632129293-323687 Content-Transfer-Encoding: quoted-printable 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 2021/9/19 13:38, John Hubbard wrote: > On 9/18/21 00:03, Weizhao Ouyang wrote: > ... >> =C2=A0 Anyway, I didn't find a simply way the build the "everywhere" r= elationship 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 th= e tricky point is that we build the "everywhere relationship" on the basis = of maintaining the original file structure, sorry for the confusing misleadi= ng. 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