Message ID | 20240820042254.99115-2-thorsten.blum@toblux.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17A7AC531DC for <linux-mm@archiver.kernel.org>; Tue, 20 Aug 2024 16:25:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 553CF6B007B; Tue, 20 Aug 2024 12:25:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 505DD6B0082; Tue, 20 Aug 2024 12:25:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CD076B0083; Tue, 20 Aug 2024 12:25:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 15D7F6B007B for <linux-mm@kvack.org>; Tue, 20 Aug 2024 12:25:02 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7C1AC1C21CE for <linux-mm@kvack.org>; Tue, 20 Aug 2024 16:25:01 +0000 (UTC) X-FDA: 82473148002.29.F75CDB2 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf30.hostedemail.com (Postfix) with ESMTP id 5FD0380009 for <linux-mm@kvack.org>; Tue, 20 Aug 2024 16:24:59 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=toblux-com.20230601.gappssmtp.com header.s=20230601 header.b=LS4vrO3g; spf=none (imf30.hostedemail.com: domain of thorsten.blum@toblux.com has no SPF policy when checking 209.85.208.54) smtp.mailfrom=thorsten.blum@toblux.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724171021; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=APU9tMJCpenUMC6yhXzDejWbQFkKRW9sw3JyNE2D4q4=; b=r1c1ooZ8o5Z7TABstRKWZFQSmaG4jD8d5LkcgTTeybcXIo1NVlKCK9vYuY4V3dTZMzasA+ CPXPWb2bFa4ZTuWP51yu2adTZcTC43qB6wKLfUJ4B+m2i02hllEW+CmyTNCQMbQPnx0HlG TLxz3P+E0gfR3GP9e0I0Foa5ka6FB/Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724171021; a=rsa-sha256; cv=none; b=30nzFhSkSxgSsV4PgRqbVQxrh+P60u/TFWR5cyIb4mUWvnR6WUhARAkG/xv9oPJnxZ7EBO XPrKrUSx9hD+zHAyHABkuds6OJO0/Zb7eFUIcS84MFw80SJ7T+6Ja1HJYRBppi/7xZJRUP +DQzsh8NS2CKKe4NgLgrfa48xQixP2I= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=toblux-com.20230601.gappssmtp.com header.s=20230601 header.b=LS4vrO3g; spf=none (imf30.hostedemail.com: domain of thorsten.blum@toblux.com has no SPF policy when checking 209.85.208.54) smtp.mailfrom=thorsten.blum@toblux.com; dmarc=none Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5bec831d77eso829737a12.0 for <linux-mm@kvack.org>; Tue, 20 Aug 2024 09:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toblux-com.20230601.gappssmtp.com; s=20230601; t=1724171098; x=1724775898; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=APU9tMJCpenUMC6yhXzDejWbQFkKRW9sw3JyNE2D4q4=; b=LS4vrO3guWRE8dMq2R+pCHcw5Uzscv1hS4v+j/3x/rnQd2zYflfGy65oEQ3SM2bglz bQ0iieypwNnBpJ+prBxG+1/jJc4O//lZhP9SsXFegt2KQ8uHkpaojvOvjs3x7+cl9K8/ bdYaKh3+UFV0zrieUaQ2Yz7lvTLPS4q32uNhVyr0pI5oybUgBCZ3A1qb2mycg/kY1zDO NBN/eeBuxgJVGf+XJhIlEA965SqbOGBlQ6eHq4apiT/AZCRK23IvwjzMKXZIISHDBv8f qbMkflIuPn2Uao/l07XgMaPIyBtRv5/TfkbTKL10gGuCcKWb1gZVf+y9voQ7GcEA48/M 4P1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724171098; x=1724775898; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=APU9tMJCpenUMC6yhXzDejWbQFkKRW9sw3JyNE2D4q4=; b=nres+kkbYDSRjwDr+vpGaRVIAeS3jFUIbMZKDmdBoZXwMGULmXWy3QQejj8kVM5zfU mo9gjwufHxPWyWOwrBfY8/FYVBIQP7UQfqyIgjz9mr/DrZOV4KTdLsQqSeo3Oke3N9N0 zWYbcY6P5BVCk81hsidMLpRiAdTg5OsTOuA6bVbeYz0W+j3RW+V1s7QA40VujcmCcsoV /cW+DXkpBUEBbnThP1IUOjE3lWB9k2xi10+yMG6spGrO84EcIQlTivXY8UuSU0ts7XWQ opNmARvu80flowwwZAHPtk0B5+azONfBrO7bfFhyizfXsqyN5BuFdZJD8W819CJj9CIM cBSA== X-Gm-Message-State: AOJu0YxUaKeMg6SABuz3nes1t9j6ICCWnoEre6czcGeNqDuczv0ODzWZ j1kooAWyhQhblhadcYTj5AFAuQgrOLB3fa6QASaz4ClPDR497ONutbqa/ySwJo0= X-Google-Smtp-Source: AGHT+IF7SKUNETxE/Jdu/YGqFLjKzRhmaqsU6MOEriSsSPJW5OwLKJqW4BGUvohJd6GSYQuTRXu1RQ== X-Received: by 2002:a05:6402:2682:b0:5be:bcdf:4118 with SMTP id 4fb4d7f45d1cf-5beca9587fcmr5345994a12.5.1724171097592; Tue, 20 Aug 2024 09:24:57 -0700 (PDT) Received: from fedora.fritz.box (aftr-82-135-80-228.dynamic.mnet-online.de. [82.135.80.228]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bf0b0cc99fsm1205498a12.49.2024.08.20.09.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 09:24:57 -0700 (PDT) From: Thorsten Blum <thorsten.blum@toblux.com> To: akpm@linux-foundation.org, david@fromorbit.com, zhengqi.arch@bytedance.com, roman.gushchin@linux.dev, muchun.song@linux.dev Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thorsten Blum <thorsten.blum@toblux.com> Subject: [PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write() Date: Tue, 20 Aug 2024 06:22:55 +0200 Message-ID: <20240820042254.99115-2-thorsten.blum@toblux.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FD0380009 X-Stat-Signature: j7ju771kzzykgbesoqksy3oumojmq7ce X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724171099-237736 X-HE-Meta: U2FsdGVkX18kz0jkaT0+wzuqzIuNto2Y2t9YYC89Ixqs/pGm0jG0PkyfuEHVavxRNjUj7i249bqLkEq+i6xNWJWgVVOzQUF7Jm79gCTcWJET4qjKun/y3MgzlDv5GLWA8V5EthdAI8y1FN+wv8WWz08Rqb6mwiWT2f9hyLQe49Usm7D+xSkYf5KmYIAcZsST8qquw8oZr5isioRaXZ9AmFO/G4m7/JdCWjYVtsHgS+9TObVWiNUMNZbS7ACkn5v+CX5drEHQEyA+TsZpzUH2yZhxsXywn7wZtpaY+WvVrsY9nZyqgQuFuCL98OZxe9xJ+gvhvrsCfnEH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ner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: shrinker: Use min() to improve shrinker_debugfs_scan_write()
|
expand
|
> On Aug 20, 2024, at 12:22, Thorsten Blum <thorsten.blum@toblux.com> wrote: > > Use the min() macro to simplify the shrinker_debugfs_scan_write() > function and improve its readability. > > Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Reviewed-by: Muchun Song <muchun.song@linux.dev> Thanks.
diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c index 12ea5486a3e9..4a85b94d12ce 100644 --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -114,7 +114,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file, int nid; char kbuf[72]; - read_len = size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1); + read_len = min(size, sizeof(kbuf) - 1); if (copy_from_user(kbuf, buf, read_len)) return -EFAULT; kbuf[read_len] = '\0';
Use the min() macro to simplify the shrinker_debugfs_scan_write() function and improve its readability. Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> --- mm/shrinker_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)