From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932220AbdHWPZ3 (ORCPT ); Wed, 23 Aug 2017 11:25:29 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:37123 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754173AbdHWPZX (ORCPT ); Wed, 23 Aug 2017 11:25:23 -0400 From: Boqun Feng To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , walken@google.com, Byungchul Park , Arnd Bergmann , Andrew Morton , willy@infradead.org, Nicholas Piggin , kernel-team@lge.com Subject: [PATCH 0/2] completion: Reduce stack usage caused by COMPLETION_INITIALIZER_ONSTACK() Date: Wed, 23 Aug 2017 23:25:36 +0800 Message-Id: <20170823152542.5150-1-boqun.feng@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With LOCKDEP_CROSSRELEASE and LOCKDEP_COMPLETIONS introduced, the growth in kernel stack usage of several functions were reported: https://marc.info/?l=linux-kernel&m=150270063231284&w=2 The root cause of this is in COMPLETION_INITIALIZER_ONSTACK(), we use ({init_completion(&work); work}) , which will create a temporary object when returned. However this temporary object is unnecessary. And this patch fixes it by making the statement expression in COMPLETION_INITIALIZER_ONSTACK() return a pointer rather than a whole structure. This will reduce the stack usage even if !LOCKDEP. However, such a change does make one COMPLETION_INITIALIZER_ONSTACK() callsite invalid, so we fix this first via converting to init_completion(). Regards, Boqun