Message ID | 20240311164638.2015063-13-pasha.tatashin@soleen.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 C2552C5475B for <linux-mm@archiver.kernel.org>; Mon, 11 Mar 2024 16:47:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EFD66B00D7; Mon, 11 Mar 2024 12:46:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89ED06B00D9; Mon, 11 Mar 2024 12:46:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CAF86B00DA; Mon, 11 Mar 2024 12:46:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5816B6B00D7 for <linux-mm@kvack.org>; Mon, 11 Mar 2024 12:46:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 25F581C0E9B for <linux-mm@kvack.org>; Mon, 11 Mar 2024 16:46:58 +0000 (UTC) X-FDA: 81885337716.30.582E12E Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by imf28.hostedemail.com (Postfix) with ESMTP id 36438C0015 for <linux-mm@kvack.org>; Mon, 11 Mar 2024 16:46:56 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Lqqt5FR+; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710175616; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w3lfkbgOqarNxaTYrCv0KyWjfiF6t60qYNqci1EaSrU=; b=t7sT1gIy9qwfe1qEoCjgCy5wHuUcGxGF3I0TYe6rO/JLKZdNBnSmXJE/vlz38p6Gpnak3T bf9e6IC6g2cx0Ivxtc1eUZwEm+7QYQnsYaHFkjEYzKRZ839MWuL2+jyCLoeQvdZ3B9V+YE BesDZ2SGXwxnDLjvZedPaKUvh6lXJTg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710175616; a=rsa-sha256; cv=none; b=VGYNwp5DcwDsK+WcO2x67tg45j4PNBqOO318h8AuEu0LfuDgovvrZLKJFNaPx0Y80Z+eci YLxgZu9Vr9Lczu014RV4bDrU0SPqQ+R+1qXSU71tN0jutnc2PB4GfSkEKf1w9v/yBuBB6K j2TLXqv0jzSWoCH5laBQQHiFCrZJ0yk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Lqqt5FR+; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-78831914027so131713185a.1 for <linux-mm@kvack.org>; Mon, 11 Mar 2024 09:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1710175615; x=1710780415; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w3lfkbgOqarNxaTYrCv0KyWjfiF6t60qYNqci1EaSrU=; b=Lqqt5FR+blWtxXtjmFu3BigorpeVks3hhCT0cuX3kBJu5/S2FSPzIgj5AtX9LAmb6J wZwurVGN6SsYdOJPakERzNMV8l7azLSUSji5Zv/LfZq9O6ZHzlgtjIJxwdL18FSa5CVf DONxlzrwfKk0QSvd71LU77l9LJI/lvsa1fxLl5Ar9FLd8FksIvU2c383iTDTZW3il2HL TOhc3ZdruwT3GELzRMvdmeafzRczjFGV6QZgKeHdHkIWXPnwNXOQx3CybbvQcJORZBuc zi7lDzLR7dh2LD3c4WvKHzgM6T1gSkXURLy0iwUPfJ++TYYyix7pyY21my49m3d0m9o2 UCWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710175615; x=1710780415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w3lfkbgOqarNxaTYrCv0KyWjfiF6t60qYNqci1EaSrU=; b=OYopkjPnidohDsWZEPjA1FKUvwJ4CNoYUHsMTMWwatrE1K8F0thn5alsZ/Qrmejbms 6o2+cRoehxW7JTdFTPzZuK7L9NxL2bD/pfoKWMrfYZyeTgFLqp6FKypbKT7hk9BdyfO7 kRLoebWDanjpgGEELgrsAVduHXqSR+Per3hS0VBzSrBPoZCL/xIMIVk/1+k/oGf8i8tX IXQ+CLo+YqTNVfEaHwAPklCvOOGoJ00k6RGCGpvXyMVkHRWKYmibrKzQa1jUxyx1LrC8 0bRqLpkfdKmNGBpfqOI+EXo/Xr4KP8ltsrZhXEJ4NKHUtlqwvLXkYh33Wd6vCUyWQ+sU BA7w== X-Forwarded-Encrypted: i=1; AJvYcCVltbcMVbHMoGwe6aQdQ0NqhMjlEAwKXkK3T5Q2aDxu0kuyvFxug/nm4V8Wa/ZXfXOsDPQb16xwRL2ddeGbV7Ky4n0= X-Gm-Message-State: AOJu0Yygizzj4S/Q0NzE+AIEPE9l82qa1uuALK7KP4UlJQ+nsn3EDoVh 2WfpBNarnaemyl7d605NohNrLxVYY1rVIN6MlgN3m0aLYumCMKjMqtg+z/bC/Fo= X-Google-Smtp-Source: AGHT+IF4l4AZR/miARXhlieJbwXHGqXTuZHHo2Erbz9LNEfZfrLPyat4CsaJX3i07UmkC9xY9bUxgA== X-Received: by 2002:a05:620a:4609:b0:788:2740:550a with SMTP id br9-20020a05620a460900b007882740550amr9951495qkb.44.1710175615373; Mon, 11 Mar 2024 09:46:55 -0700 (PDT) Received: from soleen.c.googlers.com.com (150.254.86.34.bc.googleusercontent.com. [34.86.254.150]) by smtp.gmail.com with ESMTPSA id d27-20020a05620a137b00b00788228fbe05sm2851589qkl.17.2024.03.11.09.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:46:54 -0700 (PDT) From: Pasha Tatashin <pasha.tatashin@soleen.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, x86@kernel.org, bp@alien8.de, brauner@kernel.org, bristot@redhat.com, bsegall@google.com, dave.hansen@linux.intel.com, dianders@chromium.org, dietmar.eggemann@arm.com, eric.devolder@oracle.com, hca@linux.ibm.com, hch@infradead.org, hpa@zytor.com, jacob.jun.pan@linux.intel.com, jgg@ziepe.ca, jpoimboe@kernel.org, jroedel@suse.de, juri.lelli@redhat.com, kent.overstreet@linux.dev, kinseyho@google.com, kirill.shutemov@linux.intel.com, lstoakes@gmail.com, luto@kernel.org, mgorman@suse.de, mic@digikod.net, michael.christie@oracle.com, mingo@redhat.com, mjguzik@gmail.com, mst@redhat.com, npiggin@gmail.com, peterz@infradead.org, pmladek@suse.com, rick.p.edgecombe@intel.com, rostedt@goodmis.org, surenb@google.com, tglx@linutronix.de, urezki@gmail.com, vincent.guittot@linaro.org, vschneid@redhat.com, pasha.tatashin@soleen.com Subject: [RFC 12/14] task_stack.h: Clean-up stack_not_used() implementation Date: Mon, 11 Mar 2024 16:46:36 +0000 Message-ID: <20240311164638.2015063-13-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240311164638.2015063-1-pasha.tatashin@soleen.com> References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 36438C0015 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: adcrjykh5js1s9se5g68418jqwg7j61m X-HE-Tag: 1710175616-378829 X-HE-Meta: U2FsdGVkX19WeVwQTmPL/mH2QBS6fbCpsbR/YxzbLMCjYxEdLAxI92wfZkGM1Tl/TknTiQgYrriEYwpNIpcUmCZpb7zSCHZAABkU+rK6P9QYLO+RXtxObAvMCqapdqaDfQOxSJ5xJOuylmN//TAzRRsgXhdA9nNz8wt/xLybStoTvDcCL/zTyrl0ggmBwPU1P2d8ww9y8eXWNTHBiR44hGwmvbjQgVz/CqZlibrUgnDWjR5vx/wLxlEdw66C3Ur42U3Qr9DjjWFwBUdVesWi9zi8n+9o3bpEal6WE2xYOGCmnRswCcwD7KFVgJjeBmVegd617ZKQSmXjn4HR3JQy7FaUWm4AHTRjd0fbto3iDGRT7gdbmJTQOcvnvB1plu2xjbY1zQfOaE1rQT+0KkShaZ48aoFm+KIyBewW2n5OOmlKylSwsM+1YcSk7YTXqwVJpkCmzImHuyQKUQmaMhUM3muI+4hceo7jqkNNPeMDsvvnwtogZ7xbLojNwHhBj7+GIAB/FqzXP5V55YC8ENqrYGl6BPgOnjbryLwF0B7zY05usd6X0RYS6NDzAOc4IDktB/yYM10e1HoAx0fsPMwDvyL/1Hhut8mClVBRgiA0Dg0CiKmrkR9PczEfDyZo++prLagadlC8qJEXGD+N+SuzikNvEzjcGGQr+vinjis5XHIlZyY9KtVkHF7J8s16Zv5F1tutDKVzR8UtetxWDTIbksRPGOURlTiqhnBZSIYKbxwBSZfci9tnk1fFKU601xRe4q5h1YZBEDqt/2w8e6KyHmOSRBo5mh4EBHYpikgSaTg2o8Lq81RdCzIRabYjtmntHLHRkp7QB7pWqFkCznRj7bE/Sgro0n4ReylsSBxZHinT0Y2/0U3tiQI1uMpVJrAR2S+MIP2NL1qVl61l9tRCGJe7bOMj03rtKGwiqSCNvZr04EXg0lLwP3K8n45sJxaZ5rR+i0yYFKHFHTFw8KB dto77WlD +X8/4ZkvzI1cu+sam1/3U92KZxhTNMkVOojNQadD5vuDZRMx0bHnUTB5KXB+jKmaTqBvJ9DocKoDGgqzVujxJs99BfA6NQN0NWv1T+4Lp/Mk4l6RNmjA3mU8P/fO8F/aLsV6cdeBKefREa8nrTOJDFAkf9y+1MUafJMtkhY27cjbuzY1SuPWv0quroA7Ja5+iQUdB9LnKRpYUqT2kQVXVq8Eh/Q6w9mCB/JSyNVvIYWKYlTie8pKtNYhxdA+fGnWhRmZL+rqiSUW5iuB9VhwBPrMQ5KM2dnJVfmMXVxbh2tUD5/+pygcpjz9WrbHGs0BKI6thJjL24Put+UPZeFiVwrC4FsmUFCoffrk1qd2CzYgK5FMFqtA2KGTjztlXFu2qvC/7aN0GQPrekp+crwoTPIbTaQORjO/uuIR6mL/j6gyMBcCtBzoKJF1arLhSR0gpJCMXbwSihKeJ36irmlNsoP8QPKPervKmjnAzND42bcwyC04e63DYEocaC1yiD+t32HTO X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-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 |
Dynamic Kernel Stacks
|
expand
|
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h index 4934bfd65ad1..396d5418ae32 100644 --- a/include/linux/sched/task_stack.h +++ b/include/linux/sched/task_stack.h @@ -135,25 +135,30 @@ static inline int object_is_on_stack(const void *obj) extern void thread_stack_cache_init(void); #ifdef CONFIG_DEBUG_STACK_USAGE +#ifdef CONFIG_STACK_GROWSUP static inline unsigned long stack_not_used(struct task_struct *p) { unsigned long *n = end_of_stack(p); - do { /* Skip over canary */ -# ifdef CONFIG_STACK_GROWSUP + do { /* Skip over canary */ n--; -# else - n++; -# endif } while (!*n); -# ifdef CONFIG_STACK_GROWSUP return (unsigned long)end_of_stack(p) - (unsigned long)n; -# else +} +#else /* !CONFIG_STACK_GROWSUP */ +static inline unsigned long stack_not_used(struct task_struct *p) +{ + unsigned long *n = end_of_stack(p); + + do { /* Skip over canary */ + n++; + } while (!*n); + return (unsigned long)n - (unsigned long)end_of_stack(p); -# endif } -#endif +#endif /* CONFIG_STACK_GROWSUP */ +#endif /* CONFIG_DEBUG_STACK_USAGE */ static inline int kstack_end(void *addr) {
Inside small stack_not_used() function there are several ifdefs for stack growing-up vs. regular versions. Instead just implement this function two times, one for growing-up and another regular. This is needed, because there will be a third implementation of this function for dynamic stacks. Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> --- include/linux/sched/task_stack.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)