Received: by 10.213.65.68 with SMTP id h4csp643330imn; Fri, 23 Mar 2018 12:21:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELvrS8Myil0CTXyWxtkibSd2fGjVSdWzop9Hw81AG3BPYTiJko39liqgwsMWJ7h94pO+TzPk X-Received: by 10.99.114.27 with SMTP id n27mr21418825pgc.177.1521832892656; Fri, 23 Mar 2018 12:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521832892; cv=none; d=google.com; s=arc-20160816; b=WbWUuGPRKfA891RjMNjfmmK6FM+97fc7QdRIRVmOJyL2FLM5Lyiq6yudRby9Peqvxv GJbj4obHMITiJq2uWhKsR9k8sJbNNNtkeOr1OPpaA3ZARM+n0w+JeG5uukiDB2OuvsC/ GxfOEsW9w8yDdjtGCdATjLLH6dstRMdbcU84U31FWNUcIvdjcByRxUUZ2aGKpRJCEuYp oSSV2qJUSc7dbPXQXyokMd/IYjfLhjdKa+AVpBdOABuypTR1Y8B95NrQy1V3DLthtHHJ y6So0tNE7//HV/OPLwaDPYr0QA/z0xuHsMLmyqSzDOfA22GO/+XRwLEiCKjO6/INiGm8 YN0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=JjR8qnGS45Rrol0tAEif9NLgmwpyzAyp/T6lgTwrOVg=; b=PBLemICbLJgm+tb7P/oSr7U+jK3B7u8h+1/hwg6R5f1QRpK4pLyl+RTsobPJtkPh+L Egn8Sn6zyvUJVf7+XSPmZnB3mQn42b37st9WhSImybJxCaeU/TkES6/CT84uQCY4Q7Jh A25qCCDPm/ZkRJ7OBaPjcPZWQFHQNDSPo+hiqapJHO21YqtOBvYZz825u2tkvCmdrRr3 OAHGmyH7J3KNKj/JpEGrlCCB//Ji+8qwOzbVKU4eq0w5duEo4JUsshn6nOKXuFJei7ql u5W2mAeE6Pf4k6iOhx8zNQPsvG3US9x3PwI7S2ghOa7vR2F1ytXDzPLtm+CPpSy6107V P9Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si6604124pgt.391.2018.03.23.12.21.17; Fri, 23 Mar 2018 12:21:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567AbeCWTTp (ORCPT + 99 others); Fri, 23 Mar 2018 15:19:45 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:50598 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752474AbeCWTR4 (ORCPT ); Fri, 23 Mar 2018 15:17:56 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ezSCJ-0007ay-HQ; Fri, 23 Mar 2018 13:17:55 -0600 Received: from 97-119-121-173.omah.qwest.net ([97.119.121.173] helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ezSCH-00033I-N9; Fri, 23 Mar 2018 13:17:55 -0600 From: "Eric W. Biederman" To: Linux Containers Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, khlebnikov@yandex-team.ru, prakash.sangappa@oracle.com, luto@kernel.org, akpm@linux-foundation.org, oleg@redhat.com, serge.hallyn@ubuntu.com, esyr@redhat.com, jannh@google.com, linux-security-module@vger.kernel.org, Pavel Emelyanov , Nagarathnam Muthusamy , "Eric W. Biederman" Date: Fri, 23 Mar 2018 14:16:07 -0500 Message-Id: <20180323191614.32489-4-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <87vadmobdw.fsf_-_@xmission.com> References: <87vadmobdw.fsf_-_@xmission.com> X-XM-SPF: eid=1ezSCH-00033I-N9;;;mid=<20180323191614.32489-4-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.121.173;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18obdhlYGvB3Y3HNVelXQoqf8bObTfsqXw= X-SA-Exim-Connect-IP: 97.119.121.173 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa01.xmission.com X-Spam-Level: **** X-Spam-Status: No, score=4.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,TVD_RCVD_IP,T_TooManySym_01,T_TooManySym_02, T_XMDrugObfuBody_04,XMNoVowels,XMSubLong autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 1.0 T_XMDrugObfuBody_04 obfuscated drug references X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ****;Linux Containers X-Spam-Relay-Country: X-Spam-Timing: total 869 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.0 (0.3%), b_tie_ro: 2.0 (0.2%), parse: 1.47 (0.2%), extract_message_metadata: 28 (3.2%), get_uri_detail_list: 4.4 (0.5%), tests_pri_-1000: 10 (1.2%), tests_pri_-950: 2.1 (0.2%), tests_pri_-900: 1.68 (0.2%), tests_pri_-400: 37 (4.3%), check_bayes: 35 (4.1%), b_tokenize: 18 (2.1%), b_tok_get_all: 8 (0.9%), b_comp_prob: 3.8 (0.4%), b_tok_touch_all: 2.7 (0.3%), b_finish: 0.74 (0.1%), tests_pri_0: 774 (89.0%), check_dkim_signature: 0.91 (0.1%), check_dkim_adsp: 4.0 (0.5%), tests_pri_500: 7 (0.8%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 04/11] sem: Move struct sem and struct sem_array into ipc/sem.c X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All of the users are now in ipc/sem.c so make the definitions local to that file to make code maintenance easier. AKA to prevent rebuilding the entire kernel when one of these files is changed. Signed-off-by: "Eric W. Biederman" --- include/linux/sem.h | 40 +--------------------------------------- ipc/sem.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/include/linux/sem.h b/include/linux/sem.h index 9badd322dcee..5608a500c43e 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -2,48 +2,10 @@ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H -#include -#include -#include -#include #include struct task_struct; - -/* One semaphore structure for each semaphore in the system. */ -struct sem { - int semval; /* current value */ - /* - * PID of the process that last modified the semaphore. For - * Linux, specifically these are: - * - semop - * - semctl, via SETVAL and SETALL. - * - at task exit when performing undo adjustments (see exit_sem). - */ - int sempid; - spinlock_t lock; /* spinlock for fine-grained semtimedop */ - struct list_head pending_alter; /* pending single-sop operations */ - /* that alter the semaphore */ - struct list_head pending_const; /* pending single-sop operations */ - /* that do not alter the semaphore*/ - time_t sem_otime; /* candidate for sem_otime */ -} ____cacheline_aligned_in_smp; - -/* One sem_array data structure for each set of semaphores in the system. */ -struct sem_array { - struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ - time64_t sem_ctime; /* create/last semctl() time */ - struct list_head pending_alter; /* pending operations */ - /* that alter the array */ - struct list_head pending_const; /* pending complex operations */ - /* that do not alter semvals */ - struct list_head list_id; /* undo requests on this array */ - int sem_nsems; /* no. of semaphores in array */ - int complex_count; /* pending complex operations */ - unsigned int use_global_lock;/* >0: global lock required */ - - struct sem sems[]; -} __randomize_layout; +struct sem_undo_list; #ifdef CONFIG_SYSVIPC diff --git a/ipc/sem.c b/ipc/sem.c index 01f5c63670ae..d661c491b0a5 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -88,6 +88,40 @@ #include #include "util.h" +/* One semaphore structure for each semaphore in the system. */ +struct sem { + int semval; /* current value */ + /* + * PID of the process that last modified the semaphore. For + * Linux, specifically these are: + * - semop + * - semctl, via SETVAL and SETALL. + * - at task exit when performing undo adjustments (see exit_sem). + */ + int sempid; + spinlock_t lock; /* spinlock for fine-grained semtimedop */ + struct list_head pending_alter; /* pending single-sop operations */ + /* that alter the semaphore */ + struct list_head pending_const; /* pending single-sop operations */ + /* that do not alter the semaphore*/ + time_t sem_otime; /* candidate for sem_otime */ +} ____cacheline_aligned_in_smp; + +/* One sem_array data structure for each set of semaphores in the system. */ +struct sem_array { + struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ + time64_t sem_ctime; /* create/last semctl() time */ + struct list_head pending_alter; /* pending operations */ + /* that alter the array */ + struct list_head pending_const; /* pending complex operations */ + /* that do not alter semvals */ + struct list_head list_id; /* undo requests on this array */ + int sem_nsems; /* no. of semaphores in array */ + int complex_count; /* pending complex operations */ + unsigned int use_global_lock;/* >0: global lock required */ + + struct sem sems[]; +} __randomize_layout; /* One queue for each sleeping process in the system. */ struct sem_queue { -- 2.14.1