Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1482557pxb; Thu, 14 Apr 2022 07:11:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAFCXWsHIBOVc7N21wQyToZX4tMySmVQ4SHsibL5U4TOYr3kgsKbLOKWI3YK07CKdvbsfu X-Received: by 2002:a17:906:5006:b0:6ce:3762:c72e with SMTP id s6-20020a170906500600b006ce3762c72emr2493959ejj.30.1649945512816; Thu, 14 Apr 2022 07:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649945512; cv=none; d=google.com; s=arc-20160816; b=0tTw7YZpg6yT36vYo0KqS4WBXWZXcWTcl5Aem1lmxpanMilEadimJPYn/74QxFPrPA GxaHDJtzO2pywNZGOrMb+Q6b+gtelJCKF9HadBdo/InDW1kCBOpiPx9wSgLnjVlgF1UJ wM89diEjPkhjnZWKszG210oSzZ4M95aYk3AynVrgM8otiNp/e5MuMT29qgos93cWO03T zUazw+HGGJqV1D9oB5rHmsMSLN63LGlQoDIUJAmcEcOUuAwA4/1qkCdTL+Km5sw7upNd pNHNeM3YIiHfvkdEiW6xNALXexJYREP6o+mi0QWv9Zy5Rx6eKNxUMK/0th1ZZv282SRR kXbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=u2HgXtQKzcDLmUt1wSTfoxnz8EXVoQ+Rb9J3fEt41h8=; b=D4KD3iH0XaA3jLn5j2XWT2MDtRsWCEdUPQix1EtbA+1R468ZffyA56L6+dPem7NS/N khInSShZpVY48SB/eF0rq+mGjB2ogE78lSrKrip5EORAhRYdhXsdTlVceMmJhq8LjEkv tcdEHjAOASDPBwGYo7P5Nf7Jpdgf3yIE2GqppyaBxgAob/BAJKNYEZs7OLXbZwaMVoRL hsA42opmRftu0gNgjJD5hO5GaRwFWRd43yQzdTtvulh6xU8GaDljV3gU/nJu1wCMrVFb oBfBvEqrOjG/Yiap5uQ7tNUB1FJQk7U62kwxNLzPhDtyWaZzmrN+IITm5mOtd0/GJAdH Aeyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b="CjiGxg/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fy11-20020a170906b7cb00b006e8a7c59771si1938074ejb.237.2022.04.14.07.10.54; Thu, 14 Apr 2022 07:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b="CjiGxg/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234768AbiDMW2Z (ORCPT + 99 others); Wed, 13 Apr 2022 18:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233713AbiDMW2X (ORCPT ); Wed, 13 Apr 2022 18:28:23 -0400 Received: from sonic308-55.consmr.mail.gq1.yahoo.com (sonic308-55.consmr.mail.gq1.yahoo.com [98.137.68.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E888393DE for ; Wed, 13 Apr 2022 15:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1649888759; bh=u2HgXtQKzcDLmUt1wSTfoxnz8EXVoQ+Rb9J3fEt41h8=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=CjiGxg/ESRhMddpDO+tMbAzEUGDj75D8aAZggo0d4vz49oafW0naZTXiIpZIT/e1F0pD5LoRZ6NLLsDgVt/4lyC3OqL5cjH7ik5cf4vmVe7H7IBgNR8GIbrn0Q5XBsmpgep+b+tb72+nj7CeK5Kyjzny/ikub0MQfDAEhw7EqNVIz9mpqfvzUws0RMQjfNrwnNA4/BRawAC3olf9eZsiOrpxcBsIj1yJK6tInVKrdXI+Is4P+0KcRuSsi+4Od+1nJb/ns6uTmU3mHuh/u+jGv7q4H8eCPFk8iBC29F8Chd5+g2OQa7zo1sfatmQ8nafXxujxZBYSH+IsXjnY5x56jw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1649888759; bh=6x/rO6Q1Mkt59yjPPJ+gKsFCKmUW8jHVwYxmUGeV9DS=; h=X-Sonic-MF:Date:From:Subject:To:From:Subject; b=uaO0fhNs2pbAkT7OamnVqh4CamZvMR1ff5x5rwFGGZLlS9vG7pwfE7M1E4uzJ0Tf7/sOLfOJ60CqdytFvI55wf5VzEIl0p7Re/+KzzqWZuwX2DJ84fcQMTX/RbbDAH/dsO9LzcrtySe1IhsdxvrF1F/47WU4bLou4Cnt/VuUiLKkhrO6RSFlJKhDNt8SZ0yreRGNnjk9rwQsHraWQsTdTWgBs+D/5L7R6UUTT+0xfOFiGD/th+3XQzrlUAWqaeYKo2Y+oNXRRROysNfK+lANqHMtTuOexpIuzW2JgN4Kdc3300ookjXKhT1JxV5H4pEW09PN2OOt5ohyJudHia9u/w== X-YMail-OSG: dwbgK_EVM1mzbCAFLjYYwNQp7ntxjcvjLfJ9UBTBiq0WhTPKQWaOr2xjFWQ5znU srzDqUzAj8g_hhaFC1Ojl_nQ_Izfd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YhH4ojA4sIcm77I_vSVGjxVSF6lgzuhJtrD. D5Fc_b83gclSM2HPCh5AgRZtNYkY.C.6KIOzbaUWY4ErhlfrEsLPfYCKe8d52MuJaxE3R0a5V0_Y - X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.gq1.yahoo.com with HTTP; Wed, 13 Apr 2022 22:25:59 +0000 Received: by hermes--canary-production-bf1-665cdb9985-tmblj (VZM Hermes SMTP Server) with ESMTPA ID fd626244f4329a5c70bd56ac91e1e849; Wed, 13 Apr 2022 22:25:56 +0000 (UTC) Date: Wed, 13 Apr 2022 18:25:53 -0400 From: "Alex Xu (Hello71)" Subject: Re: [PATCH] mm/smaps_rollup: return empty file for kthreads instead of ESRCH To: Andrew Morton Cc: Alexey Dobriyan , Daniel Colascione , linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka References: <20220413211357.26938-1-alex_y_xu.ref@yahoo.ca> <20220413211357.26938-1-alex_y_xu@yahoo.ca> <20220413142748.a5796e31e567a6205c850ae7@linux-foundation.org> In-Reply-To: <20220413142748.a5796e31e567a6205c850ae7@linux-foundation.org> MIME-Version: 1.0 Message-Id: <1649886492.rqei1nn3vm.none@localhost> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.20001 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Andrew Morton's message of April 13, 2022 5:27 pm: > On Wed, 13 Apr 2022 17:13:57 -0400 "Alex Xu (Hello71)" wrote: >=20 >> This restores the behavior prior to 258f669e7e88 ("mm: >> /proc/pid/smaps_rollup: convert to single value seq_file"), making it >> once again consistent with maps and smaps, and allowing patterns like >> awk '$1=3D=3D"Anonymous:"{x+=3D$2}END{print x}' /proc/*/smaps_rollup to = work. >> Searching all Debian packages for "smaps_rollup" did not find any >> programs which would be affected by this change. >=20 > Thanks. >=20 > 258f669e7e88 was 4 years ago, so I guess a -stable backport isn't > really needed. >=20 > However, we need to be concerned about causing new regressions, and I > don't think you've presented enough information for this to be determined= . >=20 > So please provide us with a full description of how the smaps_rollup > output will be altered by this patch. Quoting example output would be > helpful. >=20 >=20 Current behavior (4.19+): $ cat /proc/2/smaps; echo $? 0 $ cat /proc/2/smaps_rollup; echo $? cat: /proc/2/smaps_rollup: No such process 1 $ strace -yP /proc/2/smaps_rollup cat /proc/2/smaps_rollup openat(AT_FDCWD, "/proc/2/smaps_rollup", O_RDONLY) =3D 3 newfstatat(3, "", {st_mode=3DS_IFREG|0444, st_size=3D= 0, ...}, AT_EMPTY_PATH) =3D 0 fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) =3D 0 read(3, 0x7fa475f5d000, 131072) =3D -1 ESRCH (No such= process) cat: /proc/2/smaps_rollup: No such process close(3) =3D 0 +++ exited with 1 +++ Pre-4.19 and post-patch behavior: $ cat /proc/2/smaps; echo $? 0 $ cat /proc/2/smaps_rollup; echo $? 0 $ strace -yP /proc/2/smaps_rollup cat /proc/2/smaps_rollup openat(AT_FDCWD, "/proc/2/smaps_rollup", O_RDONLY) =3D 3 newfstatat(3, "", {st_mode=3DS_IFREG|0444, st_size=3D= 0, ...}, AT_EMPTY_PATH) =3D 0 fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) =3D 0 read(3, "", 131072) =3D 0 close(3) =3D 0 +++ exited with 0 +++ I agree that this type of change must be done carefully to avoid=20 introducing inadvertent regressions. However, I think this particular=20 change is highly unlikely to introduce regressions for the following=20 reasons: 1. I cannot think of a plausible case which would be affected. The only=20 case I can possibly imagine is a program checking whether a process=20 is a kernel thread, but this seems like a particularly silly method.=20 Moreover, the method is already broken on kernels before 4.14=20 (because smaps_rollup does not exist) and before 4.19 (because=20 smaps_rollup worked like smaps). A plausible method would be opening=20 /proc/x/(s)maps and checking that it is empty, which some programs=20 actually do. 2. Research on Debian Code Search did not find any apparent cases. I also=20 searched GitHub Code Search but found too many irrelevant results with=20 no useful way to filter them out. 3. As mentioned previously, this was already the behavior between 4.14=20 and 4.18 (inclusive). Cheers, Alex.