From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic307-5.consmr.mail.bf2.yahoo.com (sonic307-5.consmr.mail.bf2.yahoo.com [74.6.134.44]) by sourceware.org (Postfix) with ESMTPS id 45659385840E for ; Mon, 29 Nov 2021 14:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 45659385840E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sbcglobal.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sbcglobal.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s2048; t=1638196398; bh=Ki0L8wHfuaPq3DJtuc/Lzmf95KR+Oyw3UwBKueNWM0Y=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To; b=h6CNFc4vKoKJNQcKAn/0zoCKnWvwmJmPAJ5E3Yj5ADL+onOLFM928lCnZjlkR+75Yg7TdHRb93XdcserPoLXwP2ourCLQydc8gGdoBNE1lVnwGwb3eNcl3Zte5ZdabS2COkCGJRLjD4iNuwXuIuQOm2lDz6TU0qoVes9oH7MBl9JoAqAbf4SGjoF7TBjZGCqCdvNWtn0tMgndqXCp1B9hT1HsEFVy8XmV5DR5icUGfxzVNJbRaasLYTlmqJb3H40bvWrV+/xdcr+TeATyGfMVe47nPT4FOET6z4HAjOFFPLJz8cGCnOVaZDMJ94ZFsBjsAmjjs9JuTEcHKI/r+mp7A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1638196398; bh=6EwLgFCJPuPljLkF5CwBFNHePz4DcuaTVi/xvcNvHaF=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=Ekk3NlrInn8H12xjU14DcGyMsXffHw2C+nP4HvQUay3jJumnIDr5yDI7mJ/yDiYxX+2kaizX4L2yBZ9Ad7RLVbs7e3WVMJNlbh0KGNtp2fw/rkvOffrhpCqqEHviOvaI7rmR4JYJOIUWAD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25xYaW43wqmH5GeWn3V9qkWhsoscHoY_F .5XgcaUyf.UK.scnX5K5GjLNfM0CNGH1D0Bgtkm5_gtoIauNcjGdgKo32KrGZk21RZPTIXNq1DsD etDSSo8STlGV1_HI8bXgZjLTagmWhuuJjTWpXjniOTWsHUD1BZ084v9j1dEaq.MWOO2sal0LaRNn f0IrfakNlCnSTFbRv7YujuZPFgza582nkY.qvOH7ci8lIZbPxndrHzk_fDPL2qSIpVJPXEH3lzKs TbC1lP3G8xGuzk1kH6iaOXyA_RngPriyvVGQJUlhn.f5Scltldr5gsvjFY._iBUIHYaLw67efK9e vjm4AT7QTnrJXUb5ifH3xrRI- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Mon, 29 Nov 2021 14:33:18 +0000 Date: Mon, 29 Nov 2021 14:33:17 +0000 (UTC) From: "Z. Majeed" To: "cygwin-developers@cygwin.com" Message-ID: <144683159.3091493.1638196397215@mail.yahoo.com> In-Reply-To: <1388241945.3091122.1638195482524@mail.yahoo.com> References: <1016746971.2414349.1637763426878.ref@mail.yahoo.com> <1016746971.2414349.1637763426878@mail.yahoo.com> <743516839.2623934.1637863584991@mail.yahoo.com> <1907344113.875554.1637937234908@mail.yahoo.com> <2040290648.1078645.1638019007882@mail.yahoo.com> <1388241945.3091122.1638195482524@mail.yahoo.com> Subject: Re: Why is _WIN64 not defined as 1 in _cygwin.h? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.19306 YMailNorrin X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 14:33:21 -0000 Couple more points -=C2=A0https://docs.microsoft.com/en-us/windows/win32/procthread/job-object= s =C2=A0 - To obtain a handle for an existing job object, use the=C2=A0OpenJo= bObject=C2=A0function and specify the name given to the object when it was = created. Only named job objects can be opened. -=C2=A0https://docs.microsoft.com/en-us/windows/win32/api/jobapi/nf-jobapi-= isprocessinjob =C2=A0 - An application cannot obtain a handle to the job object in which i= t is running unless it has the name of the job object. However, an applicat= ion can call the QueryInformationJobObject function with NULL to obtain inf= ormation about the job object. On Monday, November 29, 2021, 09:19:31 AM EST, Z. Majeed wrote:=20 Yeah - I discovered the same after building a cygwin1.dll from master - one= of the TBB tests does exactly that https://github.com/oneapi-src/oneTBB/blob/master/test/tbbmalloc/test_malloc= _compliance.cpp#L1044 limitMem(200); ReallocParam(); limitMem(0); limitMem(0) means set rlim_cur to rlim_max your observation about the call order is reflected in getrlimit returning a= wrong value after a silent setrlimit failure I dug deeper into setrlimit and windows job objects - here are some salient= points I found in the docs linux: -=C2=A0https://man7.org/linux/man-pages/man2/setrlimit.2.html =C2=A0 - man getrlimit setrlimit =C2=A0 - an unprivileged process may set only its soft limit to a value in = the range from 0 up to the hard limit, and (irreversibly) lower its hard li= mit =C2=A0 - The value RLIM_INFINITY denotes no limit on a resource =C2=A0 - RLIMIT_AS - This is the maximum size of the process's virtual memo= ry (address space).=C2=A0 The limit is specified in bytes, and is rounded d= own to the system page size =C2=A0 - A child process created via fork(2) inherits its parent's resource= limits.=C2=A0 Resource limits are preserved across execve(2). =C2=A0 - Resource limits are per-process attributes that are shared by all = of the threads in a process. =C2=A0 - Lowering the soft limit for a resource below the process's current= consumption of that resource will succeed (but will prevent the process fr= om further increasing its consumption of the resource). windows: -=C2=A0https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jo= bobject_basic_limit_information =C2=A0 - JOB_OBJECT_LIMIT_PROCESS_MEMORY flag to enable process memory limi= ts - Causes all processes associated with the job to limit their committed = memory. If the job is nested, the effective memory limit is the most restri= ctive memory limit in the job chain. -=C2=A0https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jo= bobject_extended_limit_information =C2=A0 - JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure contains memory lim= its =C2=A0 - ProcessMemoryLimit - If the LimitFlags member of the JOBOBJECT_BAS= IC_LIMIT_INFORMATION structure specifies the JOB_OBJECT_LIMIT_PROCESS_MEMOR= Y value, this member specifies the limit for the virtual memory that can be= committed by a process. Otherwise, this member is ignored -=C2=A0https://docs.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi= 2-setinformationjobobject =C2=A0 - SetInformationJobObject function to set memory limits with a JOBOB= JECT_EXTENDED_LIMIT_INFORMATION parameter =C2=A0 - To establish the limits one at a time or change a subset of the li= mits, call the QueryInformationJobObject function to obtain the current lim= its, modify these limits, and then call SetInformationJobObject -=C2=A0https://docs.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi= 2-queryinformationjobobject =C2=A0 - QueryInformationJobObject function to get memory limits with a JOB= OBJECT_EXTENDED_LIMIT_INFORMATION parameter -=C2=A0https://docs.microsoft.com/en-us/windows/win32/procthread/job-object= s =C2=A0 - To associate a process with a job, use the AssignProcessToJobObjec= t function. After a process is associated with a job, the association canno= t be broken. A process can be associated with more than one job in a hierar= chy of nested jobs. For more information, see Nested Jobs. =C2=A0 - After a process is associated with a job, by default any child pro= cesses it creates using CreateProcess are also associated with the job =C2=A0 - To determine if a process is running in a job, use the IsProcessIn= Job function. =C2=A0 - If a process associated with a job attempts to increase its workin= g set size or process priority from the limit established by the job, the f= unction calls succeed but are silently ignored -=C2=A0https://docs.microsoft.com/en-us/windows/win32/procthread/nested-job= s =C2=A0 - Processes in a job hierarchy are either explicitly associated with= a job object using the AssignProcessToJobObject function or implicitly ass= ociated during process creation, same as for standalone jobs. =C2=A0 - When processes are implicitly associated with a job during process= creation, a child process is associated with every job in the job chain of= its parent process =C2=A0 - The effective limit for child job can be more restrictive than the= limit of its parent, but it cannot be less restrictive On Monday, November 29, 2021, 05:46:41 AM EST, Corinna Vinschen wrote:=20 On Nov 27 13:16, Z. Majeed wrote: >=20 >=20 > That was fast! Looks great Unfortunately it doesn't work as desired.=C2=A0 In contrast to Linux, chang= ing the limit to a higher limit doesn't produce an error.=C2=A0 The new nested = job has just a higher limit, while the limit of the parent job is enforced. Therefore, just adding a new nested job is not good. Apart from tha I noticed the call order was wrong=C2=A0 Adding the process = to the job should only occur *after* all other calls succeeded. > - does RLIM_INFINITY need special handling?=20 I thought not and I already had written a lengthy explanation... which I spare you with, because the code has to be rewritten anyway... Corinna